# BubbleLegend

0th

Percentile

##### Add a Legend to a Bubble Plot

Add a legend for bubbles to a bubble plot.

Keywords
aplot
##### Usage
BubbleLegend(x, y = NULL, radius, cols, labels = NULL, cols.lbl = "black", width = NULL, xjust = 0, yjust = 1, inset = 0, border = "black", frame = TRUE, adj = c(0.5, 0.5), cex = 1, bg = NULL, asp = NULL, ...)
##### Arguments
x
the left x-coordinate to be used to position the legend. See 'Details'.
y
the top y-coordinate to be used to position the legend. See 'Details'.
the radii for the bubbles in BubbleLegend.
cols
the color appearing in the legend.
labels
a vector of labels to be placed at the right side of the legend.
cols.lbl
the textcolor for the labels of the bubbles.
width
the width of the legend.
xjust
how the legend is to be justified relative to the legend x location. A value of 0 means left justified, 0.5 means centered and 1 means right justified.
yjust
the same as xjust for the legend y location.
inset
inset distance(s) from the margins as a fraction of the plot region when legend is placed by keyword.
border
defines the bordor color of each rectangle. Default is none (NA).
frame
defines the bordor color of the frame around the whole legend. Default is none (NA).
text alignment, horizontal and vertical.
cex
character extension for the labels, default 1.0.
bg
the background color for the bubble legend.
asp
the aspect ratio width/height. If this is left blank it will be calculated automatically.
...
further arguments are passed to the function text.
##### Details

The labels are placed in the middle of the legend.

The location of the legend may be specified by setting x to a single keyword from the list "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center". This places the legend on the inside of the plot frame at the given location. Partial argument matching is used. The optional inset argument specifies how far the legend is inset from the plot margins. If a single value is given, it is used for both margins; if two values are given, the first is used for x- distance, the second for y-distance. This is the same behaviour as it's implemented in legend.

legend, FindColor, legend

• BubbleLegend
##### Examples
PlotBubble(x=d.pizza$delivery_min, y=d.pizza$temperature, area=d.pizza$price, xlab="delivery time", ylab="temperature", col=SetAlpha(as.numeric(d.pizza$area)+2, .5), border="darkgrey",
na.rm=TRUE, main="Price-Bubbles", panel.first=grid())

BubbleLegend("bottomleft", frame=TRUE, cols=SetAlpha("steelblue",0.5), bg="green",
radius = c(1, 2.5, 5), labels=c(1500, 1000, 500), cex=0.8,
cols.lbl=c("yellow", "red","blue"))

Documentation reproduced from package DescTools, version 0.99.19, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.