[R] carpet plots
Jim Lemon
jim at bitwrit.com.au
Tue Jul 3 09:51:34 CEST 2012
On 07/03/2012 06:21 AM, Joseph Clark wrote:
>
> These "carpet plots" are also called "heat maps" and there's a current thread with the subject line "Heat Maps" in which I've given a couple of examples of code for them. The R function image() is very easy to use:
>
>
>
> image( x=(x values), y=(y values), z=(matrix of z values with x rows and y columns), col=(vector of colors), breaks=(vector of break points, one more than colors) )
>
>
>
> What I'd like to know is: does anyone know how to easily create a legend/key to the color gradients, like the one in the right margin of Mueller's first example: (http://www.johannes-hopf.de/wordpress/wp-content/uploads/2009/12/Zufall-300x225.png)?
>
>
Hi Joseph,
Have a look at color2D.matplot and color.legend in the plotrix package.
There is also sampcolorlegend in the shape package.
Jim
More information about the R-help
mailing list