Closed pawelru closed 5 months ago
@pawelru, there are margins that are correctly handled by the default grid::unit(1, "npc") - grid::unit(1.5, "cm")
. I tried many options, and they seem to work fine. It is fighting a bit with rstudio when it comes to knowing what is the default width of viewport, but I think it is an rstudio issue. It works perfectly in base R and with files (@BFalquet). We can enhance the documentation, but I think for the general user, we can simply discourage the visual appreciation from rstudio and look at the file exports for these cases
In my case I get this for example in rstudio (same inputs)
The fact that it's okey-ish for the default value does not change the fact that it cannot properly handle other values (e.g. the one I used in my example - unit(1, "npc")
).
There might be something with local viewport. I haven't checked create-export scenario (as opposed to create-draw one).
The longer story is that I somehow got into an email chain with the user complaining that this is not reproducible - one one machine it looked significantly different that on the other. That was for the default value you mentioned. But let's leave that user issue for a while and focus on the example i provided.
The issue should be fixed. For rstudio users the viewport width is not fixable as the conversion is off: https://github.com/rstudio/rstudio/issues/8559
Please have a look at the below example
This produces a plot with title being outside of the plot range. It looks to me that the splitting mechanism is incorrectly handling the max width parameter. The value of
unit(1, "npc")
should indicate max viewport width but not beyond that.