Description Usage Arguments Author(s) Examples
Draw a legend for a bubble plot (draw.bubble
)
1 2 3 |
x, y |
the x and y co-ordinates to be used to position the legend. |
z |
either a single value representing the largest bubble, in which case |
maxradius |
the radius of the largest bubble. this should match |
n |
integer giving the number of bubbles that should be shown in the legend. Defaults to 3. Only relevant when z is a single value. |
round |
integer indicating the number of decimal places to be used in the legend. |
bty |
single character indicating the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n" (no box). |
mab |
the margin around the bubble. i.e. how much space should there be between the largest bubble and the legend box. relative to the size of the bubble. |
bg |
background colour of the legend box. |
inset |
inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword. |
pch |
plotting character, i.e., symbol to use. Defaults to 21. |
pt.bg |
background (fill) color for the open plot symbols given by pch=21:25. |
txt.cex |
character expansion for the legend text. |
txt.col |
colour of the legend text. |
font |
An integer which specifies which font to use for text. See |
... |
any other arguments to be passed to |
Hans Gerritsen
1 2 3 4 5 6 7 8 9 10 | data(landings)
data(coast)
xlim <- c(-12,-5)
ylim <- c(50,56)
agg <- aggregate(list(z=landings$LiveWeight),list(x=landings$Lon,y=landings$Lat),sum)
basemap(xlim, ylim, main = "Gadoid landings")
draw.shape(coast, col="cornsilk")
draw.bubble(agg$x, agg$y, agg$z, maxradius=0.5, pch=21, bg="#00FF0050")
legend.bubble("topright", z=round(max(agg$z)/1000,0), maxradius=0.5, inset=0.02, bg="lightblue",
txt.cex=0.8, pch=21, pt.bg="#00FF0050")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.