[R] question about image command

Roger Peng rpeng at stat.ucla.edu
Fri May 2 05:02:58 CEST 2003


This is a regularly asked question and the solutions are varied.  The
default image() command does not place a legend on the plot.  There are 
three options that I know of:

1.  the image.plot()  function in the `fields' package.  This function has
similar syntax as image() but the resulting image can be difficult to
annotate sometime.

2.  the filled.contour() function in the `base' package produces nice
images but read the help page carefully if you want to add things
(text, points, etc) to the plot.

3.  the levelplot() function in the `lattice' package.  

The problem with 1 and 2 is that you cannot put more than one image on a
device because they use the layout() function.  levelplot() allows you to
put multiple images on the same device using a common legend.  Note that
levelplot() takes different arguments from image.plot() and
filled.contour().

-roger
_______________________________
UCLA Department of Statistics
http://www.stat.ucla.edu/~rpeng

On Thu, 1 May 2003, Mikyoung Jun wrote:

> Hello,
> 
> I have a question about image command. When you draw a image plot, and 
> let's say we use gray scale. then how can I generate a little bar next to 
> the plot which shows the grey levels and the values which corresponds to 
> the grey level? ( it doesn't matter whether I am using grey level or not. 
> It could be just any colors...)
> 
> The only way that I can do right now is overlaying contour plot on the 
> image plot...
> 
> Thank you!
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>



More information about the R-help mailing list