[R] Re: Universal legend in plot

Vumani Dlamini dvumani at hotmail.com
Fri Jan 17 13:29:06 CET 2003


Dear R-users:

I asked a question on how I can have a universal legend in a plot and 
received the following result. I tried using "layout" but I can't seem to 
work on the "empty" plot (where I have to have the legend). I tried "oma" 
but I couldn't improve the quality of the plot, and that I didn't know how 
to specify all the line types using the keyboard, infact it is line type 4 
(I had _._ and it didn't look nice).

#
I am trying to create a graph with 6 panels, but would like to have a 
universal legend as each panel merely denotes a separate stratum. The legend 
has to be at the bottom.

I use "par(mfrow=c(2,3))" to get the panels, but am not sure how to put the 
legend below the whole graph.

Thanking you as always

############
J.R. Lockwood

I don't think you can do this without

layout()

which you can use to create a separate graphical area within the plot
region, where you can put the legend.

i could be wrong though
############
Peter Dalgaard

You need to look at mtext(....,outer=TRUE), plus par(oma=....) to make
room for the text in the outer margins.
############
Try layout() for finer adjustments (and some drawbacks).
See ?layout how to set up a 7th figure (legend) of full with below the 
desired six other figures.

Uwe Ligges




More information about the R-help mailing list