%% Plot Data from a Table
% 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 X and Y1 variables. By default, the axis labels match the variable names.

tbl = table(randi(2,100,1),randn(100,1),randn(100,1)+10, ...
   'VariableNames',{'X','Y1','Y2'});

swarmchart(tbl,'X','Y1')

%
% You can also plot multiple variables at the same time. For example, plot the Y1 and Y2 variables on the y-axis by specifying the yvar argument as the cell array {'Y1','Y2'}. Then add a legend. The legend labels match the variable names.

swarmchart(tbl,'X',{'Y1','Y2'})
legend

% Copyright 2020 The MathWorks, Inc.