1 minute read

Too Slow to Analyze������������������������������������������������������������������������������������������������������

Chapter 4 ■ Visualizing Data

We can see this in action with the iris data. We can plot the four measurements for each species in different facets, but they are on slightly different scales so we will only get a good look at the range of values for the largest range. We can fix this by setting the y-axis free. Contrast Figure 4-21 and Figure 4-22.

Advertisement

iris %>% gather(Measurement, Value, -Species) %>% ggplot(aes(x = Species, y = Value)) + geom_boxplot() + facet_grid(Measurement ~ .)

Figure 4-21. Iris measures plotted on the same y-axis

iris %>% gather(Measurement, Value, -Species) %>% ggplot(aes(x = Species, y = Value)) + geom_boxplot() + facet_grid(Measurement ~ ., scale = "free_y")

98

This article is from: