Graphics Reference
In-Depth Information
Figure 8-38. Top: with default breaks on the x-axis; bottom: with breaks specified
Notice that the formatting of the breaks changed. You can specify the formatting by using the
date_format() function from the scales package. Here we'll use "%Y %b" , which results in a
format like “1992 Jun”, as shown in Figure 8-39 :
library(scales)
p + scale_x_date(breaks = datebreaks, labels = date_format( "%Y %b" )) +
theme(axis.text.x = element_text(angle = 30 , hjust = 1 ))
Search WWH ::




Custom Search