[R] 3d barplot in rgl
bbolker
bolker at ufl.edu
Wed Sep 26 01:38:50 CEST 2007
hadley wrote:
>
> On 9/25/07, Chris Stubben <stubben at lanl.gov> wrote:
>> hadley wickham <h.wickham <at> gmail.com> writes:
>>
>> >
>> > Why do you want a 3d barchart? They are generally a bad way to
>> > present information as tall bars can obscure short bars, and it is
>> > hard to accurately read off the height of a bar. While adding
>> > rotation can reduce some of these problems, why not create a graphic
>> > that your viewers can take in with a glance?
>> >
>>
>> 3d barplots are a common way to display sensitvity/elasticity matrices in
>> stage-structured demography. Here's a few other options from Caswell's
>> Matrix
>> population models book (2001) - I definitely prefer 3d barcharts to
>> these
>> alternatives.
>>
>>
>> heatmap(log10(A[3:1,]), Rowv = NA, Colv = NA, scale="none")
>>
>> plot(log10(c(A)), type="s")
>
> Both of those look like equally awful alternatives. Perhaps you could
> explain more about your data (perhaps with a sample?) so that we could
> suggest better alternatives.
>
> Hadley
>
Transition matrices are Markov transition matrices among different
life stages of organisms -- in the simplest case (Leslie matrices,
tracking age-structured populations), the top row of the matrix represents
fecundity and the first off-diagonal (below the diagonal) represents
survival. The elasticities and sensitivities are differential (absolute
or proportional) responses
of long-run population growth rate [i.e., the largest eigenvalue] to changes
in
matrix elements.
In the Leslie case the matrix is quite sparse and it would be easy to just
plot sensitivities/elasticities of fecundities and survivorship.
In the more complicated case (Lefkovitch matrices), the categories
represent
stages rather than ages so individuals can stay in the same class from year
to year,
or even revert to the previous class, so the matrix is less sparse and the
problem
is a little more challenging.
Here are some data from the popbio package on CRAN
for playing with.
library(popbio)
example(teasel) ## shows 2 plots -- heatmap and stair-step
A <- tea$sensitivities ##
Here's one possibility, setting 0 sensitivities to NA to omit
them from the plot:
z <- as.data.frame.table(A)
names(z) <- c("From","To","Sensitivity")
z$Sensitivity[z$Sensitivity==0] <- NA
dotplot(From~Sensitivity|To,data=z)
dotplot(From~Sensitivity|To,data=z,scales=list(x=list(log=TRUE)))
I turned the plot horizontally to make it easier to draw labels
(as lattice often does), but this might be too confusing.
Sorry not to use ggplot2, but I haven't sat down to try to figure
it out yet ....
--
View this message in context: http://www.nabble.com/3d-barplot-in-rgl-tf4517380.html#a12891221
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list