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

fix wrong guides for null unit key size #390

Merged
merged 11 commits into from
Sep 13, 2024
Merged

Conversation

Yunuuuu
Copy link
Contributor

@Yunuuuu Yunuuuu commented Sep 5, 2024

fix #389

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Sep 5, 2024

p1 <- ggplot(mtcars) +
  geom_point(aes(mpg, disp)) +
  ggtitle("Plot 1")

p3 <- ggplot(mtcars) +
  geom_point(aes(hp, wt, colour = mpg)) +
  ggtitle("Plot 3")
wrap_plots(
  p1 + p3 + scale_color_continuous(guide = guide_colorbar(
    theme = theme(legend.key.height = unit(1, "null"))
  )),
  guides = "collect"
)

image

R/guides.R Outdated Show resolved Hide resolved
R/guides.R Outdated Show resolved Hide resolved
R/guides.R Outdated Show resolved Hide resolved
R/guides.R Outdated Show resolved Hide resolved
@thomasp85
Copy link
Owner

The build failures are being fixed on main so no need to worry about those

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Sep 6, 2024

Thanks for your review

@thomasp85
Copy link
Owner

I would love to get this into the next release. I'm planning on starting submission on friday so if you have the possibility of addressing the last question beforehand I would be grateful. If not, no worries and we will just merge it after release

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Sep 10, 2024

Hi, @thomasp85, it’s not necessary to use calc_element here, because we always re-define the values of legend.spacing in line 136-138 (function assemble_guides), this is what package_box in ggplot2 does.

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Sep 10, 2024

I'm sorry to later reply, I replied on the the review comment, it seems you cannot see the message (marked as the Pending label).

image

@thomasp85
Copy link
Owner

Ah - I see. Then all is good

@thomasp85
Copy link
Owner

Can I get you to add a bullet to NEWS.md?

@teunbrand
Copy link
Contributor

teunbrand commented Sep 10, 2024

Can I just quickly interject that calc_element() was added in #365 for compatibility with the development version of ggplot2. I recommend checking wether {patchwork} tests succeed with current dev ggplot2.

@thomasp85
Copy link
Owner

thanks - yes, I remembered something like this. Can I get you to change it to using calc_element() @Yunuuuu ?

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Sep 10, 2024

Thanks for the recomment, I'll make the updates.

@thomasp85
Copy link
Owner

Another time (just to save you some pain) make sure to create a new branch in your fork for a PR, rather than working directly from main. the usethis package has a bunch of pr_*() functions that steers you into a happy workflow :-)

@thomasp85 thomasp85 merged commit 6d14415 into thomasp85:main Sep 13, 2024
12 checks passed
@thomasp85
Copy link
Owner

Thank you for your help in this as well as pushing me to do more about free()

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Sep 13, 2024

Thanks for the review and all of the advices!

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

Successfully merging this pull request may close these issues.

Wrong guides for null unit legend key size
3 participants