%% Plot Table Data with Custom Marker Sizes and Colors
% Since R2021b
% One way to plot data from a table and customize the colors and marker sizes is to set the ColorVariable and SizeData properties. You can set these properties as name-value arguments when you call the scatter3 function, or you can set them on the Scatter object later.
% For example, read patients.xls as a table tbl. Plot the relationship between the Systolic, Diastolic, and Weight variables with filled markers. Vary the marker colors by specifying the ColorVariable name-value argument. Return the Scatter object as s, so you can set other properties later.

tbl = readtable('patients.xls');
s = scatter3(tbl,'Systolic','Diastolic','Weight','filled', ...
    'ColorVariable','Diastolic');

%
% Change the marker sizes to 100 points by setting the SizeData property. Then add a colorbar.

s.SizeData = 100;
colorbar

% Copyright 2020 The MathWorks, Inc.