Out of curiosity, does the auto margin parameter in tpar() override all user supplied settings, or is it still possible for them to change?
For example, if I think that main and sub are too tight with one a other, can I add some spacing?
Yes and no. It's a bit complicated, but I'll try to explain briefly:
I ended up deciding to narrowly interpret "dynamic" as limited to las adjustment. (That's not completely true b/c there is some minor legend adjustment stuff that happens too, but just go with it for now.)
To that end, the whitespace reduction specifically around the axis titles etc. is actually baked into the theme default mar and mpg settings (see here). We could easily make these adjustments dynamic too (i.e., only kick in if tpar("dynmar")==TRUE) and, indeed, this is how I had originally implemented it. Upon reflection, however, I decided that it made more sense to make this part of the "hardcoded" theme settings. Thus, the whitespace around the axis titles (for the relevant themes) is reduced irrespective of whether we are also trying to dynamically adjust for horizontal y-axis text too. Basically, I think that whitespace reduction around the axis ticks and titles should be a fixed feature of the theme, rather than relying on some clever internal tricks to adjust spacing dynamically. (Let me know if you disagree.)
Okay, now to your question. Here's a default plot for the "bw" theme:
tinytheme("bw") tinyplot( I(Sepal.Length*1e9) ~ Petal.Length, data = iris, main = "Title of the plot", sub = "Subtitle of the plot" )
This theme includes an extra 0.5 line whitespace penalty around the margin of the axis titles (and a similar adjustments for shorter tick lines, but we can ignore that for this example). To undo this whitespace reduction, we could do:
# remove (undo?) extra 0.5 whitespace reduction around axis titles tinytheme("bw", mar = c(5.1, 4.1, 4.1, 2.1) - c(1+0.3, 0.3, 0, 1.5), mgp = c(3, 1, 0) - c(0.3, 0.3, 0)) tinyplot( I(Sepal.Length*1e9) ~ Petal.Length, data = iris, main = "Title of the plot", sub = "Subtitle of the plot" )
(Note the axis titles have more space around them.)
For example, if I think that main and sub are too tight with one a other, can I add some spacing?
This, unfortunately we can't change right now since main and sub do not inherit the same mgp logic as the axes. So we'd either have to connect the latter, or introduce a new tpar parameter that explicitly governs spacing between the title and subtitle.
(Another option would be to include a linebreak in either main or sub, but that too is not something I've enabled checking and adjustment for yet.)