%% Plot Data from a Table
% Since R2021b
% A convenient way to plot data from a table is to pass the table to the swarmchart function and specify the variables you want to plot. For example, create a table with three variables of random numbers, and plot the X1, and Y variables. By default, the axis labels match the variable names.

tbl = table(randn(100,1),randn(100,1)+10,randn(100,1), ...
   'VariableNames',{'X1','X2','Y'});

swarmchart(tbl,'X1','Y');

%
% You can also plot multiple variables at the same time. For example, plot the X1 and X2 variables on the x-axis by specfying the xvar argument as the cell array {'X1','X2'}. Then add a legend. The legend labels match the variable names.

swarmchart(tbl,{'X1','X2'},'Y');
legend

% Copyright 2020 The MathWorks, Inc.