Graphics Reference
In-Depth Information
Figure 8-5. Box plot on which y range has been expanded to include 0
Reversing a Continuous Axis
Problem
You want to reverse the direction of a continuous axis.
Solution
Use scale_y_reverse or scale_x_reverse ( Figure 8-6 ). The direction of an axis can also be
reversed by specifying the limits in reversed order, with the maximum first, then the minimum:
ggplot(PlantGrowth, aes(x = group, y = weight)) + geom_boxplot() + scale_y_reverse()
# Similar effect by specifying limits in reversed order
ggplot(PlantGrowth, aes(x = group, y = weight)) + geom_boxplot() + ylim( 6.5 , 3.5 )
Search WWH ::




Custom Search