Hi, On Sat, Feb 11, 2012 at 8:07 PM, Jonas Stein <n...@jonasstein.de> wrote: >> There are various alternatives available; you can also write your own, >> by modifying the standard one. > >> Generally there are lots of possibilities for customizing within the >> standard one; e.g. y.intersp will affect the line spacing, using a >> negative value for inset (together with xpd=NA) will allow the legend to >> be moved outside the plot. > > i tried without success: > > plot(1:10) > legend(1,3, legend=c("one", "two"), inset=-1, xpd=NA) > > The legend is still placed inside the plot on point (1,3) > > What could i have done wrong?
Wrong? Nothing. You told R to put the legend at c(1,3) so it did. If you want it elsewhere you need to specify that. legend(-1,3, legend=c("one", "two"), inset=-1, xpd=NA) maybe, or some other location? > Can i include a legend like this in a standard plot like > plot(1:10) too? > http://www.r-bloggers.com/wp-content/uploads/2011/03/heatmap.png Yes. What part of that do you want to duplicate? You can specify colors, symbols, labels, etc. in legend(). Also, please link to the original blog post, not just the figure, so that the author gets some credit and we can see the code used. Sarah > kind regards, > > -- > Jonas Stein <n...@jonasstein.de> > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@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.