Graphics Reference
In-Depth Information
These commands control the appearance of only the tick labels, on only one axis. They don't
affect the other axis, the axis label, the overall title, or the legend. To control all of these at once,
you can use the theming system, as discussed in Using Themes .
See Also
See Changing the Appearance of Text for more about controlling the appearance of the text.
Changing the Text of Axis Labels
Problem
You want to change the text of axis labels.
Solution
Use xlab() or ylab() to change the text of the axis labels ( Figure 8-19 ):
library(gcookbook) # For the data set
hwp <- ggplot(heightweight, aes(x = ageYear, y = heightIn, colour = sex)) +
geom_point()
# With default axis labels
hwp
# Set the axis labels
hwp + xlab( "Age in years" ) + ylab( "Height in inches" )
Search WWH ::




Custom Search