Skip to content

legend in image()

3 messages · Jason Turner, Sam McClatchie, Roger D. Peng

#
On Tue, Sep 17, 2002 at 12:50:04PM +1200, Sam McClatchie wrote:
Does "filled.contour()" do roughly what you want?

Cheers

Jason
#
System info:
Linux slackware
R Version 1.5.1  (2002-06-17)
ESS 5.1.21
Emacs 21.2.1
-------------------
Colleagues

Is there a way to add a legend to an image plot? I don't see any 
reference to legends in the documentation (so I suppose the answer is 
no?). Although the documentation says image takes plot() parameters, it 
isn't clear to me how the usual use of legend in a plot command would go 
for image(). Perhaps you need to specify 'breaks' and then use something 
like:

legend(x,y, breaks, c('label1', label2'...))
?

Here is my function call at the moment without a legend:

  image(time.h, z, -log10(t5),
         xlab='hours', ylab='depth m',
         col=rainbow(20),
         main = 'Chatham Rise DVM',
         yaxt='n', zlim=c(2,6.5), cex=0.5)

Thanks in advance,

Sam
#
Check out `image.plot' in the `fields' package.  Also, `filled.contour'
may do what you want (and seems to produce nicer pictures).

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng
On Tue, 17 Sep 2002, Sam McClatchie wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._