bubblelegend

Adds a legend that explains the bubble sizes of a bubble chart.

Category: Graphics > 2-D and 3-D Plots

Syntax

bubblelegend(title)

Adds a bubble legend with the given title.

bubblelegend(title, 'Location', loc)

Places the legend at a location such as 'eastoutside'.

bl = bubblelegend(___)

Also returns the legend object.

Description

The legend shows three sample bubbles with the data values they stand for, so the reader can decode the size channel. Call it after bubblechart or bubblechart3; the sizes follow bubblesize and bubblelim.

Input arguments

title
Title shown above the sample bubbles.
'Location'
Position of the legend relative to the axes.

Output arguments

bl
A BubbleLegend object.

Example

Legend for sizes

bubblechart(1:4, [2 4 1 3], [10 40 20 80]);
bl = bubblelegend('Population');
disp(class(bl))
Output
matlab.graphics.illustration.BubbleLegend

See also

bubblechart bubblechart3 bubblesize bubblelim legend