Skip to content

Instantly share code, notes, and snippets.

@mja
Created May 24, 2010 13:04
Show Gist options
  • Save mja/411831 to your computer and use it in GitHub Desktop.
Save mja/411831 to your computer and use it in GitHub Desktop.
Options for ggplot2
# Options for ggplot + opts(...)
# These don't seem to be documented on the web. Listed here for reference.
# list current setting
theme_get()
# Make a plot
g <- ggplot(...)
# Print the plot with options
g + opts(...)
panel.background=theme_rect(fill='pink', colour='pink', size=1, linetype=1)
# the background of each panel
panel.border
panel.grid.minor = theme_line()
panel.grid.minor=theme_line()
# Remove legend. Useful if you want to redo it manually or
# you have a factor with lots of levels
legend.position="none"
# text
plot.title = theme_text(size = 40)
axis.title.x = theme_text()
axis.text.x = theme_text(angle=, size=, hjust=) # size is in points
# ticks
axis.ticks = theme_segment()
axis.ticks.length = unit(0.3, "cm"))
axis.line
strip.background
strip.text.x
strip.text.y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment