%% Specify Location and Number of Bubbles
% Create a bubble chart. Then call the bubblelegend function with a return argument to store the BubbleLegend object as blgd. Move the legend outside the plot box by setting the Location property on the object to 'northeastoutside'. Display two bubbles instead of three by setting the NumBubbles property to 2.

x = 1:50;
y = rand(1,50);
sz = randi([20 500],[1,50]);
bubblechart(x,y,sz)

% Create bubble legend and set properties
blgd = bubblelegend('Population');
blgd.Location = 'northeastoutside';
blgd.NumBubbles = 2;

% Copyright 2020 The MathWorks, Inc.