Learn R Programming

ggmap (version 2.5.2)

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).

Examples

Run this code
library(ggplot2)
n <- 50
df <- expand.grid(x = 1:n,y = 1:n)[sample(n^2,.5*n^2),]
p <- qplot(x, y, data = df, geom = 'tile')
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()

qplot(1:10,1:10) +
  theme_nothing()  +
  theme(panel.background = element_rect(fill = "black"))


df$class <- factor(sample(0:1, .5*n^2,  replace = TRUE))
p <- qplot(x, y, data = df, geom = "tile", 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)

Run the code above in your browser using DataLab