[R] Move legend text to the left legend box border

baptiste auguie baptiste.auguie at googlemail.com
Wed Aug 19 11:03:03 CEST 2009


I believe you want "x.intersp",

txt <- c("Setosa Petals", "Versicolor Sepals")

plot(1,1,t="n")

legend("top", txt, text.col=1:2, cex=0.7,
inset=c(0,1/3))

legend("center", txt, text.col=1:2, cex=0.7,
x.intersp = -0.5)

HTH,

baptiste

2009/8/19 Stefan Grosse <singularitaet at gmx.net>:
> On Wed, 19 Aug 2009 10:20:03 +0200 Sigbert Klinke
> <sigbert at wiwi.hu-berlin.de> wrote:
>
> SK> in legend I'am coloring my text rather than using symbols or lines:
> SK>
> SK> legend("bottomleft", txt, text.col=col, cex=0.7)
> SK>
> SK> However, between the left legend box border and the text in txt is a
> SK> large empty space. Can I somehow move the text more to the left and
> SK> get also a smaller legend box?
>
> try
> legend("bottomleft", txt, text.col=col, cex=0.7,inset=-0.05)
> and play around with the inset value.
>
> hth
> Stefan
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

http://newton.ex.ac.uk/research/emag




More information about the R-help mailing list