ggopt: Set global options for ggplot.

theme_bwR Documentation

Set global options for ggplot.

Description

These are aliased into every plot object, so that p$grid.col will return the default grid colour, unless it has been overriden for a particular plot object. You can change the global options using the function, or the options for a specific plot by setting the values directly on the object. See the examples for more details.

Usage

theme_bw

theme_default

ggopt(...)

ggtheme(theme)

Arguments

...

named options to set

theme

list of options set

Format

An object of class list of length 2.

An object of class list of length 11.

Details

Colour settings:

  • axis.colour: axis text and line colour ("black")

  • background.colour: background text colour ("black"), used for title

  • background.fill: background fill ("white")

  • grid.colour: plot grid colour ("white")

  • grid.fill: plot grid background fill ("grey90")

Strip settings

  • strip.text: function with two arguments (variable, and value) used for generating strip labels

  • strip.gp: graphic parameter settings for the strip

  • strip.text.gp: graphic parameter settings for the strip text

Legend settings

  • legend.position: position of legend: "none" to hide legend; "left", "right", "top", "bottom", for positioning outside of plot; c(x, y) for positioning on top of plot

Other settings:

  • aspect.ratio: aspect ratio of facets. Set to NULL to allow to vary with device size

Examples

# Change global options
ggopt(background.fill = "black", background.color ="white")
p <- ggpoint(ggplot(reshape::tips, smoker ~ sex,aesthetics = list(y = tip, x = total_bill)))
p

# Change individual plot options
p$background.fill = "white"
p
p$strip.text.gp <- grid::gpar(col="red", fontsize=8)
p$background.colour <- "pink"
p$grid.colour <- "green"
p$grid.fill <- "blue"
p # a very ugly plot!

# Use ggtheme(theme_default) to reset back to the
# default theme.
ggtheme(theme_default)

hadley/ggplot1 documentation built on Dec. 1, 2024, 11:23 a.m.