A Density Plot (also known as a density chart) is used to compare the distributions of one or more variables. They can be used to detect irregular distributions within a single variable and compare densities between different variables. Note that
Data/Inputs
A table or variable(s).
The following is an explanation of the options available in the Object Inspector for this specific visualization. Refer to Visualization Options for general chart formatting options.
Chart
APPEARANCE
-
Plot vertically Rotates the bean plot by 90 degrees
Plot the individual data value Creates a rug plot beneath the density plot, as shown in the example below.
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, so as to create a smooth end to the plot.
Output
The example below uses data from a fast-food tracking study. The plot shows the distribution of fast food consumed for different age groups. Since the Y-axis represents density (probability density), and not raw counts, it is hard to interpret and these values are not shown in the visualization.
Acknowledgements
The density is computed using the base R density function, and the plot is created using plotly.
Method
- In Displayr: How to Create a Density Plot
- In Q: How to Create a Density Plot