This article describes how to create a Bean plot. A Bean Plot is a mirrored density plot, with a rug plot between the densities showing unique values. Similar to a boxplot and histogram, bean plots are used to compare the distributions of different groups.
Requirements
You need a variable containing numeric data or a crosstab containing numeric data in the rows.
Method - Using variable inputs
- Go to Visualization
> Distributions > Bean from the toolbar.
- Under Data > Data Source > Variables, select your numeric variable.
- In the Groups box, select a grouping variable.
- Click Calculate and/or ensure Calculate Automatically is checked.
Note that this method comes with some caveats.
Method - Using a table input
- Select the table that has the numeric data in the Rows.
- From the object inspector
, go to Visualization > Distributions > Bean.
Options
These options are specific to this chart type, available in the Object Inspector under Chart > Appearance.
- Plot vertically Rotates the bean plot by 90 degrees.
- Data value color Sets the value of the dashes in the rug.
- Bandwidth The relative width of the bandwidth used to compute the density (the smaller the value, the 'bumpier' the plot).
- Automatically compute lower bound If selected, the left side of the plot is set to the lowest value observed in the other data. Otherwise, it is set to be further to the left than this, to create a smooth end to the plot.
Acknowledgments
The density is computed using the base R density function, and the plot is created using plotly.