-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
It used to be the behavior of ggplot that you could use a default theme (like theme_minimal()) and then specify a further change with a subsequent use of theme(). That no longer seems to be the case.
library(tidyverse)
library(ggtext)
ggplot(
economics, aes(date, unemploy)
) +
geom_line() +
scale_x_date(
breaks = seq.Date(
"1970-01-01" %>% as.Date,
"2012-01-01" %>% as.Date,
length.out = 5
),
labels = str_c(
"**",
seq(1970, 2010, by = 10),
"**"
)
) +
theme(
axis.text.x = element_markdown()
)
Now, imagine if I wanted to keep the markdown for the x axis labels, but use theme_minimal() otherwise. You formerly could use
ggplot(
economics, aes(date, unemploy)
) +
geom_line() +
scale_x_date(
breaks = seq.Date(
"1970-01-01" %>% as.Date,
"2012-01-01" %>% as.Date,
length.out = 5
),
labels = str_c(
"**",
seq(1970, 2010, by = 10),
"**"
)
) +
theme_minimal() +
theme(
axis.text.x = element_markdown()
)
but now it returns (ie the theme(axis.text.x = ....) is ignored.)
How can one set a theme() element after using a complete theme?
EvaMaeRey
Metadata
Metadata
Assignees
Labels
No labels
