how to plot a nice legend?
Have a lookt at the package ggplot2 I believe it will give you something like the image you link to. Simple example: ---------------------------------------------------------------------------------- library(ggplot2) mydata <- data.frame(a=1:10, b=1:10, c=letters[1:10]) ggplot(mydata, aes(a,b, colour=c)) + geom_point() ---------------------------------------------------------------------------------- John Kane Kingston ON Canada
-----Original Message----- From: news at jonasstein.de Sent: Sun, 12 Feb 2012 02:07:06 +0100 To: r-help at stat.math.ethz.ch Subject: Re: [R] how to plot a nice legend?
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?
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
kind regards,
--
Jonas Stein <news at jonasstein.de>
______________________________________________ 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.
____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!