sidelegend | R Documentation |
sidemargin
prepares the margin, sidelegend
puts the legend in it.
sidelegend(...)
sidemargin()
... |
passed to |
sidemargin
returns the previous par
settings, so that they can be reset for futher plots.
sidelegend
returns the same value as legend
.
# Make a basic plot
attach(iris)
plot(Petal.Length, Petal.Width, col=Species, pch=19)
legend(1, 2, legend=levels(Species), col=1:nlevels(Species), pch=19)
# The same with the legend on the side
pars <- sidemargin()
plot(Petal.Length, Petal.Width, col=Species, pch=19)
sidelegend(legend=levels(Species), col=1:nlevels(Species), pch=19)
par(pars) # reset graphical parameters
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.