Skip to content
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

Possible regression: invalid 'layout.pos.row' #132

Closed
lindeloev opened this issue Dec 1, 2019 · 7 comments
Closed

Possible regression: invalid 'layout.pos.row' #132

lindeloev opened this issue Dec 1, 2019 · 7 comments

Comments

@lindeloev
Copy link

lindeloev commented Dec 1, 2019

I am using patchwork to arrange bayesplot plots. I'm attaching one such plot, plot1.zip, which is a facet_wrap'ed plot using ncol = 1. Use load("plot1.RData") to load it.

In the "old" patchwork GitHub version (unsure how old, unfortunately, but between two months and a year), this would make two columns as expected:

    plot1 + plot1 

However, with the CRAN version 1.0.0, it yields the following error:

Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  invalid 'layout.pos.row'

I'm just including one plot here, but the issue exists with different bayesplot plots as well. patchwork 1.0.0 works just fine with "home-made" faceted plots, so it's possible that this is bayesplot not conforming to standards. The grid package seems to be the origin of the layout.pos.row variable.

I don't know if it's of any use, but the following does not raise an error for nrow >= 2. Unfortunately, the resulting plot is "stacked" and the y-axis is inverted:

plot1 + plot1 + plot_layout(ncol = 2, nrow = 7)

image

@thomasp85
Copy link
Owner

Can you share the code used to generate the plot? Somehow the structure of the plot doesn't conform with the expectations...

@lindeloev
Copy link
Author

Absolutely. I attach the data, plot_data.zip which is an mcmc.list. You can make the plot using

plot1 = bayesplot::mcmc_dens_overlay(plot_data, facet_args = list(ncol = 1))

The issue seems to be general for many (all?)

bayesplot::mcmc_[[type]](plot_data)

i.e., without facet_args too. E.g., mcmc_trace(), mcmc_dens(), etc.

@thomasp85
Copy link
Owner

weirdly this is an issue with the bayesplot theme...

plot1 + plot1 & theme_gray()

works

@lindeloev
Copy link
Author

Confirmed! This is good enough for me to get on. I considered making some changes to that theme anyway, so this is a good excuse.

@thomasp85
Copy link
Owner

I've identified this to be due to strip.placement = 'outside' — no idea when that started to not work

@lindeloev
Copy link
Author

Great. For future googlers, this is a simple fix/workaround for now:

plot1 + plot1 & theme(strip.placement = NULL)

sthagen added a commit to sthagen/thomasp85-patchwork that referenced this issue Dec 2, 2019
Fix thomasp85#132 Gap between axis and strip whith strip.placement = 'outside'…
@mdozmorov
Copy link

mdozmorov commented Dec 9, 2021

Googling for Error in grid.Call.graphics(C_setviewport, vp, TRUE) : invalid 'layout.pos.col' brought me to this issue. p1 + p2 & theme(strip.placement = NULL) doesn't eliminate it. grid.arrange(p1, p2, ncol = 2) works fine. Versions of grid 4.1.0, gridExtra 2.3, patchwork 1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants