Creating a box and whisker chart

Box and whisker plots, also called box plots, are charts that divide their data points into quartiles. Box plots are great at comparing distributions of data for different groups or categories side by side.

In this recipe, we will create a box and whisker plot that shows the spread of points garnered by NBA teams from 2000-2009.

Creating a box and whisker chart

Getting ready

To follow this recipe, open B05527_02 – STARTER.twbx. Use the worksheet called Box and Whisker, and connect to the Player Stats (NBA Players Regular Season 2009) data source.

Getting ready

How to do it...

The following are the steps to create a box and whisker plot:

  1. From Dimensions, drag League to the Filters shelf and filter to N for NBA.
  2. From Dimensions, drag Year to the Filters shelf and choose years 2000-2009.
  3. Ctrl + click Year from Dimensions and Points from Measures to select both data fields from the side bar.
  4. While Year and Points are still selected, expand Show Me.
  5. Select the Box and Whisker plot icon in Show Me, as shown in the following screenshot. This will place Year in the Details property in the Marks card, and SUM(Points) in the Rows shelf.
    How to do it...
  6. Move Year from the Details in the Marks card to the Columns shelf.
  7. From Dimensions, drag Team Name to Details in the Marks card.
  8. Click on Size in the Marks card to make the Circle marks smaller.
  9. Right-click on the box and whisker plot that gets created, and select Edit….
  10. Under Plot Options, choose Maximum extent of the data option for the Whiskers extend to setting. Click OK when done.
    How to do it...

How it works...

Box and whisker plots allow you to show the spread of your data, and can easily show where 50% of your data is.

This recipe is probably one of the few recipes that start with Show Me. This is because in this case, we select a dimension, Year, and a measure, Points, first and then click on the box and whisker plot in Show Me. The following is what Show Me creates. Each circle represents the points in a specific field.

How it works...

If we want to show this by year, then we can move Year from Details to the Columns shelf, which will give us the following viz.

How it works...

What's missing in this box and whisker plot is the scatter. We need to see the individual teams' points as individual points. To do this, we can add the team name onto Details in the Marks card. Remember that adding a field onto Detail changes the level of detail of the visualization; in this case each point is now the sum of points for Year and Team.

Once team name is added, we can see the variation in team points from year to year, and we can note that the box is where 50% of the points lie (thus where 50% of the teams are for that year).

As for the whisker, the default option is to plot the lines based on points that are within 1.5 times the IQR (interquartile range).

There is another option to extend the whiskers to the maximum extent of the points. This extends the whiskers even to the outliers, making outliers even more prominent. However this will skew your boxes.

There's more...

Box and whisker plots can be shown whenever you want to see how the variations compare. Here is a box-and-whisker plot for the same data set used in this recipe, but this time narrowed down to the Phoenix Suns players who played for the Phoenix Suns for at least 3 years between 2000 and 2009. Each point represents that player's points for a year. The smaller box may mean that the player is more consistently producing points per year. The longer the box means the more variation—in some years the player does very well, and other years not so much.

There's more...

See also

  • Please refer to the Creating a scatter plot recipe in Chapter 1, Basic Charts.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.255.168