Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

theme_nothing

Make a blank ggplot2 theme.


Description

theme_nothing simply strips all thematic element in ggplot2.

Usage

theme_nothing(base_size = 12, legend = FALSE)

Arguments

base_size

base size, not used.

legend

should the legend be included?

Value

a ggplot2 theme (i.e., a list of class options).

Author(s)

Examples

# no legend example
n <- 50
df <- expand.grid(x = 1:n,y = 1:n)[sample(n^2,.5*n^2),]
p <- ggplot(df, aes(x, y)) + geom_raster()
p
p + theme_nothing()
p + theme_nothing(legend = TRUE) # no difference
p +
  scale_x_continuous(expand = c(0,0)) +
  scale_y_continuous(expand = c(0,0)) +
  theme_nothing()



# legend example
df$class <- factor(sample(0:1, .5*n^2,  replace = TRUE))
p <- ggplot(df, aes(x, y)) + geom_raster(aes(fill = class))
p
p + theme_nothing()
p + theme_nothing(legend = TRUE)

p <- p +
  scale_x_continuous(expand = c(0,0)) +
  scale_y_continuous(expand = c(0,0))
p
p + theme_nothing()
p + theme_nothing(legend = TRUE)

ggmap

Spatial Visualization with ggplot2

v3.0.0
GPL-2
Authors
David Kahle [aut, cre] (<https://orcid.org/0000-0002-9999-1558>), Hadley Wickham [aut] (<https://orcid.org/0000-0003-4757-117X>), Scott Jackson [aut], Mikko Korpela [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.