-
Notifications
You must be signed in to change notification settings - Fork 633
Subplot panel height not consistent #2144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I found a hack to get the size of the panels to be as i specify.
Notice how the deviations from the specified value are multiples of 2, likely this may help to track down the issue. But for now the deviation can be described by an equation of the form |
Unfortunately when specifying margins they are also inconsistent. |
This is code accounts for presence of margins:
|
I had some good results with corr_margin <- function(m, margin) {
if (m >= 3L) {
average_margin <- margin * (m - 2) / m
outer_size <- 1 / m - average_margin
inner_size <- 1 / m - average_margin + margin
return(c(outer_size, rep(inner_size, m - 2L), outer_size))
}
NULL
} E.g., if you have 3 rows and a top and bottom margin of 0.05 each, you would write subplots(..., heights = corr_margin(3, 0.05)) Similar for left/right via width. |
There doesn't seem to be a way to set the total figure size for
subplot()
.Individual panel height can be specified in the call to
plot_ly
and (as i understand it) that height is scaled with the number of panels to become the total figure size.I tried using this by passing to each subplot the individual plotheight multiplied with the number of subplots (nrows) so the total height of the total figure would be plotheight * nrows.
It turns out the heights aren't strictly adhered too.
Comparing the total height of the first two panels you can clearly see the x axes are at different heights:
The text was updated successfully, but these errors were encountered: