You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reseting tinytheme() in sourced script yields LHS margin errors for _preceding_ plots #474
It took me a while to isolate this down to a simple MWE, since I first observed the behaviour in a more complicated example. But consider the following script:
library(tinyplot)
tinytheme("classic")
tinyplot(I(mpg*1000) ~wt, data=mtcars)
# Reset the theme
tinytheme()
Running this code interactively works exactly as expected. However, if I source it by copying it and running reprex::reprex(), I get the following, with overlapping y-axis text:
The culprit appears to be that the LHS margin hasn't adjusted properly. What's truly odd here is that the problem only occurs if you reset the theme, i.e. call tinytheme() at the end. In other words, it somehow affects the preceding plot. (??) Compare the reprex::reprex() when I drop the last two lines:
Off the bat, I genuinely don't understand what's causing this. But I did notice that this issue is also present in our ?tinythemeonline documentation (and similarly if you source the examples locally):
Activity
grantmcdermott commentedon Sep 15, 2025
Actually, that's not quite correct. Running all the text in one go also yields the same undesirable overlapping text.
:-/