Typical problems
When you first encounter a data visualization, either from yourself or a colleague, you always want to critically ask if it's obscuring the data in any way.
Let's take a look at the steps we could take to produce and improve the plot in the view.
The data comes from an experiment where the effect of two different types of vitamin C sources, orange juice or ascorbic acid, were tested on the growth of the odontoblasts (cells responsible for tooth growth) in 60 guinea pigs.
The data is stored in the TG
data frame, which contains three variables: dose
, len
, and supp
.
This exercise is part of the course
Intermediate Data Visualization with ggplot2
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Initial plot
growth_by_dose <- ggplot(TG, aes(dose, len, color = supp)) +
stat_summary(fun.data = mean_sdl,
fun.args = list(mult = 1),
position = position_dodge(0.1)) +
theme_gray(3)
# View plot
growth_by_dose