83 Exercise 1
Create a stacked Density plot using the ToothGrowth
data set to observe the varying distribution of tooth lengths according to the dose supplied(as a factor). You would want to use the len
variable as an aesthetic and fill with factor(dose)
. Make sure the plot is stacked by specifying position=stack
in the geom_density
layer.
ggplot(ToothGrowth, aes(len, fill = factor(dose))) +
geom_density(position = "stack")
![](081-to_ggplot_or_not_to_ggplot-some_other_other_geom_files/figure-html/q1-solution-1.png)