[R] Positioning text in top left corner of plot

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

This works fine for one plot, but if it is a multiple plot (mfrow=c(2,2)
say) then each individual label is placed in the same position i.e.
absolute top left on the canvas.  I would like it top left of each
individual plot.

Thanks anyway.  Got any idea how to fix this?


Paul Murrell wrote:
> Hi
> 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?
> plot(1:10)
> library(grid)
> grid.text("What do we want?  Text in the corner!\nWhere do we want it?
> Here!",
>           x=unit(2, "mm"), y=unit(1, "npc") - unit(2, "mm"),
>           just=c("left", "top"))
> Paul
>> Thanks
>> Benilton Carvalho wrote:
>>> maybe this is what you want?
>>> plot(rnorm(10))
>>> legend("topleft", "A)", bty="n")
>>> ?
>>> b
>>> On Aug 7, 2007, at 11:08 AM, Daniel Brewer wrote:
>>>> Simple question how can you position text in the top left hand
>>>> corner of
>>>> a plot?  I am plotting multiple plots using par(mfrow=c(2,3)) and all I
>>>> want to do is label these plots a), b), c) etc.  I have been fiddling
>>>> around with both text and mtext but without much luck.  text is fine
>>>> but
>>>>  each plot has a different scale on the axis and so this makes it
>>>> problematic.  What is the best way to do this?
>>>> Many thanks
>>>> Dan

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