[R] How can we add a legend to a set of graphs?
J.delasHeras at ed.ac.uk
J.delasHeras at ed.ac.uk
Sat May 19 23:30:09 CEST 2007
Quoting Duncan Murdoch <murdoch at stats.uwo.ca>:
> On 18/05/2007 7:33 PM, Judith Flores wrote:
>> Hi,
>>
>> I have a set of 4 graphs and I need to add a legend
>> that is shared by those 4 graphs. This is what I
>> tried:
>>
>>> locator(1) # I placed the cursor in the center of the
>> 4 graphs
>> $x
>> [1] 9.299001
>>
>> $y
>> [1] 226.3201
>>
>>
>>> legend(9.3,226.3,"and the rest of the legend
>> arguments")# but the legend didn't show.
>>
>> The legend only appears when I place in inside any
>> of the for plots. How can I place it outside these
>> plots, in the center.
>
> RSiteSearch("legend outside")
>
> suggests using par(xpd=TRUE).
>
> Duncan Murdoch
You may also want to try ?mtext, with the paramater 'outer=TRUE'
Jose
--
Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk
The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6513374
Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK
More information about the R-help
mailing list