%% Create Box Charts from Matrix Data
% Use box charts to compare the distribution of values along the columns and the rows of a magic square.
% Create a magic square with 10 rows and 10 columns.

Y = magic(10)

% Create a box chart for each column of the magic square. Each column has a similar median value (around 50). However, the first five columns of Y have greater interquartile ranges than the last five columns of Y. The interquartile range is the distance between the upper quartile (top edge of the box) and the lower quartile (bottom edge of the box).

boxchart(Y)
xlabel('Column')
ylabel('Value')

% Create a box chart for each row of the magic square. Each row has a similar interquartile range, but the median values differ across the rows.

boxchart(Y')
xlabel('Row')
ylabel('Value')

% Copyright 2019 The MathWorks, Inc.