%% Customize Marker Appearance with Table Variables
% For some plots, you can vary the color, size, and transparency of the markers in your plot according to certain variables in your table. Some functions have arguments for specifying those aspects. For example, create a bubble chart of the patients data set. Plot the Weight variable versus the Height variable. Use the fourth argument to vary bubble sizes according to the Diastolic variable. Use the fifth argument to vary the color according to the Age variable.
% Add a colorbar and resize the bubbles so that they range between 5 and 20 points.

tbl = readtable("patients.xls");
figure
bubblechart(tbl,"Height","Weight","Diastolic","Age")

% Add a colorbar and resize the bubbles
colorbar
bubblesize([5 20])

%
% When you use the scatter function, you can use name-value arguments or set properties on the Scatter object to control different aspects of the markers. For example, create a scatter plot with filled markers, and set the ColorVariable property by specifying a name-value argument. Then add a colorbar.

figure
s = scatter(tbl,"Height","Weight","filled","ColorVariable","Age");
colorbar

%
% Next, vary the transparency of the markers according to the Systolic variable. To do this, you must also set the MarkerFaceAlpha property to 'flat'.

s.AlphaVariable = "Systolic";
s.MarkerFaceAlpha = "flat";

% Copyright 2020 The MathWorks, Inc.