Replies: 2 comments 8 replies
-
Fun experiment! I don't have anything to contribute because I rarely use
Or perhaps less side-effect-y: plot1 + theme_linedraw()
plot2 + theme_last_plot() |
Beta Was this translation helpful? Give feedback.
1 reply
-
Just here to point that the obvious solution doesn't work. library(ggplot2)
last_theme <- function(plot = last_plot()) plot$theme
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme(text = element_text(colour = "red")) ggplot(mtcars, aes(disp, mpg)) +
geom_point() +
last_theme() +
theme(line = element_line(linetype = "dotted")) Created on 2024-12-09 with reprex v2.1.1 |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Thinking about this workflow, I thought his might be a good 'advent of code' challenge: https://bsky.app/profile/gforb.bsky.social/post/3lciojslcuc2t
'Copy and pasting the same + theme(...) line into every plot.'
I'd though about a variant: 1) build plot (explore data) 1.b) make plot look good; adjust plot w/ theme() 2) set theme based on last plot w/ set_theme_last_plot() 3) keep plotting.
I didn't manage to write a working set_theme_last_plot()! I think I need to make
t1
look liket2
before trying to write the set_theme_last_plot() function.Created on 2024-12-09 with reprex v2.1.0
Beta Was this translation helpful? Give feedback.
All reactions