%% Create Bubble Cloud with Table Data
% Create a table with three variables. For example, create a table that shows the number of mislabeled Halloween costumes in 10 states. Of the 10,000 princess kits sold, 1,000 had spooky monster labels by mistake.

n = [58 115 81 252 180 124 40 80 50 20]';
loc = ["NJ" "NY" "MA" "OH" "NH" "ME" "CT" "PA" "RI" "VT"]';
plant = ["Plant A" "Plant A" "Plant A" "Plant A" ...
       "Plant A" "Plant A" "Plant A" "Plant B" "Plant B" "Plant B"]';
tbl = table(n,loc,plant,'VariableNames',["Mislabeled" "State" "Manufacturing Plant"])

%
% Create a bubble cloud to visualize the mislabeled costumes by state.

bubblecloud(tbl,"Mislabeled","State")

%
% Divide the bubbles into groups by specifying the groupvar argument. In this case, the groups are in the variable called "Manufacturing Plant".

bubblecloud(tbl,"Mislabeled","State","Manufacturing Plant")

% Copyright 2020 The MathWorks, Inc.