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!
I wonder if filled.contour() does what you want: example(filled.contour) Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia andreww at cheque.uq.edu.au Quoting Mikyoung Jun <jun at galton.uchicago.edu>:> 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 >
There are several options, the simplest is to use filled.contour() instead of image(). The output is slightly different, but that usually doesn't matter. On Thursday 01 May 2003 09:26 pm, 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
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 >
Possibly Parallel Threads
- overlaying a contour line in a levelplot
- Overlaying a single contour from a new data array in levelplot
- Lattice levelplots and (partial) failure on some devices ----Long
- using alpha transparency for lines in levelplot
- Filled contour plot showing labeled isolines?