[R] Re: Universal legend in plot

Andrew C. Ward andreww at cheque.uq.edu.au
Fri Jan 17 13:49:03 CET 2003


Is your data such that it can be restructured into a form amenable to a 
lattice plot, such as xyplot()? In that case, the legend (key in lattice) 
can be placed pretty much anywhere.


Regards,

Andrew C. Ward

CAPE Centre
Department of Chemical Engineering
The University of Queensland
Brisbane Qld 4072 Australia
andreww at cheque.uq.edu.au



On Friday, January 17, 2003 10:22 PM, Vumani Dlamini 
[SMTP:dvumani at hotmail.com] wrote:
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list