[R] Positioning text in top left corner of plot

Daniel Brewer daniel.brewer at icr.ac.uk
Fri Aug 10 13:03:56 CEST 2007


Thanks.  That works if it is only a single plot, but if there are
multiple plots (e.g. par(mfrow=c(2,2))) it confusingly puts the label in
the absolute top left always i.e. the top left of plot one.

Dan

S Ellison wrote:
> Try something like
> mtext(side=3, line=-1, text="Here again?", adj=0, outer=T)
> 
> This puts text just inside the top left corner.
> 
> 
>>>> Jim Lemon <jim at bitwrit.com.au> 10/08/2007 10:37:30 >>>
> Daniel Brewer wrote:
>> Thanks for the replies, but I still cannot get what I want.  I do not
>> want the label inside the plot area, but in the top left of the paper, I
>> suppose in the margins.  When I try to use text to do this, it does not
>> seem to plot it outside the plot area.  I have also tried to use mtext,
>> but that does not really cut it, as I cannot get the label in the
>> correct position.  Ideally, it would be best if I could use legend but
>> have it outside the plot area.
>>
>> Any ideas?
>>
> Hi Dan,
> 
> Try this:
> 
> plot(1:5)
> par(xpd=TRUE)
> text(0.5,5.5,"Outside")
> par(xpd=FALSE)
> 
> Jim


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addre...{{dropped}}



More information about the R-help mailing list