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 · 6 comments
Closed

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

lindeloev opened this issue Dec 1, 2019 · 6 comments

Comments

@lindeloev
Copy link

@lindeloev 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

This comment has been minimized.

Copy link
Owner

@thomasp85 thomasp85 commented Dec 2, 2019

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

@lindeloev

This comment has been minimized.

Copy link
Author

@lindeloev lindeloev commented Dec 2, 2019

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

This comment has been minimized.

Copy link
Owner

@thomasp85 thomasp85 commented Dec 2, 2019

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

plot1 + plot1 & theme_gray()

works

@lindeloev

This comment has been minimized.

Copy link
Author

@lindeloev lindeloev commented Dec 2, 2019

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

This comment has been minimized.

Copy link
Owner

@thomasp85 thomasp85 commented Dec 2, 2019

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

@lindeloev

This comment has been minimized.

Copy link
Author

@lindeloev lindeloev commented Dec 2, 2019

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

plot1 + plot1 & theme(strip.placement = NULL)
@thomasp85 thomasp85 closed this in 012fb8b Dec 2, 2019
sthagen added a commit to sthagen/patchwork that referenced this issue Dec 2, 2019
Fix thomasp85#132 Gap between axis and strip whith strip.placement = 'outside'…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.