[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")


legend("top", txt, text.col=1:2, cex=0.7,

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



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,


More information about the R-help mailing list