Skip to content

Instantly share code, notes, and snippets.

@yuu-ito
Last active August 29, 2015 14:07
Show Gist options
  • Save yuu-ito/277bdf2ecd7309386214 to your computer and use it in GitHub Desktop.
Save yuu-ito/277bdf2ecd7309386214 to your computer and use it in GitHub Desktop.
R/ggplot2/theme/element_text/angle
# http://docs.ggplot2.org/current/theme.html
# http://docs.ggplot2.org/current/scale_date.html
a <- AirPassengers
ap.df <- data.frame(
year=seq(from=as.Date("1949-01-01"),to=as.Date("1960-12-01"),by="1 month"),
passengers=as.numeric(a)
)
p <- qplot(data=ap.df,x=year,y=passengers)+geom_line()+scale_x_date(labels = date_format("%Y/%m/%d"))
print(p)
p2 <- p+theme(axis.text.x=element_text(angle=-90,vjust=0))
print(p2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment