I have tried and tried unsuccessfully to place a legend outside the plot frame of a graph. This would allow me to draw a legend for an image() plot. But any legend I add is cut off outside the axes. Is there a way of doing this? Thanks for any advice on how to make this work (I'm using R1.5.1 with Windows 2000). Richard Condit Smithsonian Tropical Research Institute Unit 0948 APO AA 34002-0948 condit at ctfs.si.edu conditctfs at yahoo.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Tue, 10 Sep 2002, Richard Condit wrote:> I have tried and tried unsuccessfully to place a legend outside the plot > frame of a graph. This would allow me to draw a legend for an image() plot. > But any legend I add is cut off outside the axes. > > Is there a way of doing this? Thanks for any advice on how to make this > work (I'm using R1.5.1 with Windows 2000).Look at whether filled.contour() does what you want. If not, you can use the same method that it uses: call layout() to create two subscreens, one for the legend and one for the plot -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
You have two options that you more or less need to evaluate for yourself. One is the 'image.plot' function in the 'fields' library. This function is useful and I've used it successfully a few times but you need to do some careful calibration of the parameters to make the picture look good. The other option is the 'filled.contour' function (in the base package) which I think generally produces better pictures (but can be a lot slower). I think both 'image.plot' and 'filled.contour' both split the plot device into two separate regions (one for image and one for legend). But 'filled.contour' uses kind of a hack-ish mechanism (via the plot.axes and key.axes arguments) which gives you access to the coordinate systems of the separate plot regions so that you can add text, labels, points, etc. This is really useful! In general, I like 'filled.contour' better and try to use it for these kinds of plots. Unfortunately, 'filled.contour' uses 'layout' so cannot be used in multiple panel displays. 'image.plot' can be used in such a situation. Hope this helps! -roger _______________________________ UCLA Department of Statistics rpeng at stat.ucla.edu http://www.stat.ucla.edu/~rpeng On Tue, 10 Sep 2002, Richard Condit wrote:> I have tried and tried unsuccessfully to place a legend outside the plot > frame of a graph. This would allow me to draw a legend for an image() plot. > But any legend I add is cut off outside the axes. > > Is there a way of doing this? Thanks for any advice on how to make this > work (I'm using R1.5.1 with Windows 2000). > > > Richard Condit > Smithsonian Tropical Research Institute > Unit 0948 > APO AA 34002-0948 > > condit at ctfs.si.edu > conditctfs at yahoo.com > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks for a number of answers on how to place a legend outside a plot. There were several recommending using layout() for a plot and a separate legend. I will file these away for future reference. The easy answer which works great is par(xpd=T). Rick Richard Condit Smithsonian Tropical Research Institute Unit 0948 APO AA 34002-0948 condit at ctfs.si.edu conditctfs at yahoo.com -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear List, My apologies for the multiple postings, which apparently were received by everyone on the list. For some reason the follow-ups were not echoing back to me, nor were they ever received by the archive (http://maths.newcastle.edu.au/~rking/R/help/02a/index.html) so I honestly assumed that no one was seeing them. (where did they go?) I did receive my last follow-up (after I unsubscribed and then re-subscribed), so there might have been a problem with my email address, which was not the same one I originally subscribed under. It was certainly not my intention to force anyone to respond to my questions. Sorry again, John Day -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._