Skip to content

legend() outside plotting region

3 messages · Jim Lemon, Ko-Kang Kevin Wang

#
Hi,

Is it possible to put the legend outside the plotting region?

Say, I have some 24 lines within my plot, which pretty much filled the
plotting region and left me no space (well not enough space) to put in a
legend.  So I'd like to put the legend outside the plotting region
(i.e. the region enclosed by the two axis -- I hope I got my terminology
right).

Actually, I did the 24 lines with something like:
 for(i in 1:ncol(FOO))
     lines(FOO[, i], lty = i)
where FOO is my data frame containing 24 columns.  As a side track, is
there a better way to represent this, as 24 lines is very difficult to
distinguish anyhow.  This data frame, by the way, is a time series.

Cheers,

Kevin

------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Ko-Kang Kevin Wang wrote:
After you have plotted the data, use

par(xpd=T)

and then legend() with x,y values where you want it.
24 lines would probably confuse the average spider. What do you want to 
illustrate? If it is a comparison between one group of lines and another, 
you might be able to plot two polygons showing the region that each group 
occupies, or something like that.

Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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, 27 Aug 2002, Jim Lemon wrote:

            
I agree 24 lines are too many (probably for anyone, cetainly for me 
:-)).  But they represent the traffic rate across 24 different switches,
therefore I've been thinking, for a long time, whether it is sensible to
(say) separate into two graphs.  The problem is the switches are of the
same type in the same geographical regions.  So I'm not sure if separaion
will result in misinforming people...

Cheers,

Kevin

------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._