Mathcad’s New Box Plots
We’ve introduced three new plot types to both Mathcad 15 and Mathcad Prime 1.0. Box plots, effects plots, and Pareto plots provide quick visualization of data. Here’s how to make a box plot.
You may know box plots as box-and-whisker diagram. Box plots were first introduced by statistician John Tukey in his book, Exploratory Data Analysis, published in 1977 by Addison-Wesley.
Box plots display data very efficiently and enable quick scanning and comparison.
A box plot consists of several sections. A central box displays the middle 50% of the data, while the top and bottom of the box, or hinges, indicate the 25% and 75% percentiles. Each section is called a quartile. The line drawn across the box indicates the median value enabling you to quickly see when the median value skews high or low in the dataset.
The top of the vertical line or whisker indicates the maximum value, while the bottom whisker line displays the minimum value.
The spacing within the box shows how disperse the data is. The overall picture allows you to compare different data sets.
Box plots also display outliers by dots above and below the minimum data values. An outlier is any value that is more than 1.5 times the interquartile range above or below the endpoints of that range.
Creating a Box Plot
Enter a matrix for your data. Below is a sample data set of a surface. You can substitute your own data.
Mathcad Prime 1.0 Box Plots
In Mathcad Prime 1.0, prepare the data to be plotted using the Mathcad Prime function, boxplot.
The boxplot function returns a matrix that you can use to generate box plots.
The first three rows represent the 25%, median, and 75% quartiles.
The third and fourth rows represent the minimum and maximum values of each data sets.
The last row displays any outliers. You can see that -3.04 is an outlier. The other cells in that row are filled with NaN’s (not a number).
Set a column vector with the labels for each row of data. The labels must be strings.
- Insert an XY plot.
- Then enter the transposed matrix as the x-axis argument. To transpose a matrix, type Ctrl+Shift+T.
- Next add the labels as the y-axis argument.
- Finally click in one of the axis expressions, and select Plots tab > Change Type > Box Trace.
A box appears for each row of data.
By comparing the data sets, you can see the variation between each data set. Note that the first two boxes, have very skewed data since the median value is not in the center of the box. The data in the last set is not as disperse as the other data sets.
Mathcad 15 Box Plots
Start from your dataset as a data table or matrix.
Prepare the data to be plotted using the Mathcad 15 function, boxplotgraph.
The function boxplotgraph returns a nested vector of two elements that you can use to generate box plots.
- Insert an X-Y plot.
- Then enter the first element as the x-axis argument using a matrix index to indicate the first element.
- Next add the second element as the y-axis argument.
A box appears for each data set.
By comparing the data sets, you can see the variation between each data set. Note that the first two boxes have very skewed data since the median value is not in the center of the box. The data in the last set is not as disperse as the other data sets.
Go to the Mathcad Community website to use the Mathcad Prime 1.0 and Mathcad 15 worksheets as templates for visualizing your data as box plots.