[R] levelplot/heatmap question
Jim Lemon
jim at bitwrit.com.au
Thu Sep 25 12:19:24 CEST 2008
cerman at u.washington.edu wrote:
> Hello!
> I have data containing a large number of probabilities (about 60) of
> nonzero coefficients to predict 10 different independent variables (in
> 10 different BMA models). i've arranged these probabilities in a
> matrix like so:
>
> (IV1) (IV2) (IV3) ...
> p(b0) p(b0) p(b0)
> p(b1) p(b1) p(b1)
> p(b2) p(b2) p(b2)
> ...
>
>
> where p(b1) for independent variable 1 is p(b1 != 0) (given model
> uncertainty - using the BMA package). i've also set it so that if the
> coefficient is negative, the probability is listed as negative (to be
> able to distinguish between significant positive and negative effects
> by color).
>
> i'd like to create a plot which is a 10x60 grid of rectangles, where
> each rectangle is colored according to its probability of being
> nonzero (preferably white would correspond to a zero probability).
> i've looked into levelplot, heatmap, and image, and cant seem to get
> exactly what im looking for.
>
> heatmap gives me problems in that the output is inconsistent with the
> data - among other things, the first and last rows do not seem to show
> up (they are just white, despite clearly nonzero probabilities). even
> if i do not use the dendrogram (Rowv and Colv set to NA), i still seem
> to have an issue with a probability in a given row not corresponding
> to the same color as the same probability in a different row.
>
> levelplot seems to do exactly what i want it to do, except that i cant
> find a way to label the individual columns and rows, which I really need
>
> any ideas how to obtain the graph i want? Thanks!
Hi Nate,
Have a look at color2D.matplot, especially the last example.
Jim
More information about the R-help
mailing list