Skip to content

theme(x, y) versus theme(x) + theme(y) #3039

Closed
microly/ggplot2
#2
@ptoche

Description

@ptoche

I had always assumed that the following were equivalent. They are not. Is it a feature of theming that all the options must be set in theme() in one pass?

If so, may I suggest adding an example like below to: https://ggplot2.tidyverse.org/reference/theme.html

library(reprex)

library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
    geom_point() +
    theme_void() + 
    theme(axis.line.x = element_line(color = "blue"),
          axis.ticks.x = element_line(color = "red"),
          axis.ticks.length = unit(1, "cm")) 

Created on 2018-12-15 by the reprex package (v0.2.1)

library(reprex)
library(ggplot2)
ggplot(mtcars, aes(wt, mpg)) +
    geom_point() + 
    theme_void() + 
    theme(axis.line.x = element_line(color = "blue")) +
    theme(axis.ticks.x = element_line(color = "red")) +
    theme(axis.ticks.length = unit(1, "cm")) 

Created on 2018-12-15 by the reprex package (v0.2.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorthemes 💃

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions