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

Compatibility with ggplot2 3.5.0 #148

Merged
merged 7 commits into from
Feb 12, 2024
Merged

Compatibility with ggplot2 3.5.0 #148

merged 7 commits into from
Feb 12, 2024

Conversation

teunbrand
Copy link
Contributor

Hi there,

I apologise for not abiding by the checklist. We have been preparing a new release of ggplot2 and during a reverse dependency check, it became apparent that the prospecive ggplot2 3.5.0 would break thematic.

The function that would break checks is the theme_relationships(), as there are now elements that inherit from two parents instead of 1:1 inheritance (minor axis ticks length). The proposed changes herein do not resolve the multiple inheritance, but merely prevents breaking the function.

Here is an example of minor ticks in use with this PR:

devtools::load_all("~/packages/test/thematic/")
#> ℹ Loading thematic
library(ggplot2) # 3.5.0

thematic_local_theme(theme = thematic_theme(fg = "red"))

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  guides(
    x = guide_axis(minor.ticks = TRUE),
    y = guide_axis(minor.ticks = TRUE)
  )

Created on 2024-01-19 with reprex v2.1.0

A second thing we've changed is the resolution of legend text and titles. These are now resolved internally based on the text/title position within the legend, to give these appropriate margins and justifications. The pre-computation of these theme elements in full, renders these internal resolutions void, and legend text/titles would appear misplaced. In this PR, justification and margin overrides for the relevant theme elements has been disabled. This change is not absolutely necessary, but I figured it might be desired.

In addition to aforementioned issues, I think it might be a good idea to review the visual checks and possibly make a decision of whether the new legend.frame, legend.ticks and legend.key.spacing.y elements should also be exempt from pre-computation. This is more of a matter of taste, so I'm not in a position to advise here.

For reasons of unfamiliarity, I wasn't able to judge the shiny tests in any meaningful capacity.

To test the code changes with the release candidate, you can install it with the code below:

remotes::install_github("tidyverse/ggplot2", ref = remotes::github_pull("5592"))

The release of ggplot2 3.5.0 is scheduled for the 12th of February. The progress of the release can be tracked in tidyverse/ggplot2#5588. We hope that this PR might help thematic get out a fix if necessary.

@CLAassistant
Copy link

CLAassistant commented Jan 19, 2024

CLA assistant check
All committers have signed the CLA.

@teunbrand
Copy link
Contributor Author

This is just a kind reminder that the release of ggplot is scheduled soon.

@cpsievert
Copy link
Collaborator

This is great, thanks so much!

@cpsievert cpsievert merged commit 3db4490 into rstudio:main Feb 12, 2024
3 checks passed
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.

3 participants