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

change plotting to work with ggplot2 >=v3.5 #2236

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Conversation

immanuelazn
Copy link
Collaborator

@immanuelazn immanuelazn commented Nov 26, 2024

Details

ggplot2 version 3.5 had added a myriad of changes to legend objects, converting from S3 objects, to ggproto. Additionally, the legend interface had been heavily rewritten, with the grobs now having attr for legends in four positions rather than the one shared position in a plot previously. Lastly, empty grob objects, which were previously dropped, are no longer dropped, breaking our internal logic (<simpleError in g$grobs[[legend]]: no such index at level 2>)

This broke ArchR's ability to create legends, since we use this information when fixing plot sizes. This fixes plotting issues by validating that any legends detecting in a plot's grob are indeed non-empty.

Fixes issues #2150, #2123, #2130, #2168, #2234, #2210

Tests

  • Ran with all unit tests. Confirm that previous errors resulting from ggplot have been reduced to 0

@immanuelazn immanuelazn changed the base branch from master to dev November 26, 2024 07:04
@immanuelazn immanuelazn changed the title Ia/fix ggplot legends change plotting to work with ggplot2 >=v3.5 Nov 26, 2024
@immanuelazn immanuelazn marked this pull request as ready for review November 26, 2024 07:26
@immanuelazn immanuelazn merged commit 474a057 into dev Nov 26, 2024
@mohsinbadat
Copy link

mohsinbadat commented Nov 28, 2024

Sorry this may be a really basic question, but I've been having this issue, what's the fix I need to apply to sort things out? Thanks a lot! I know I need to change the VisualizeData.R script with the inserted lines but not sure how to find this file...

@immanuelazn
Copy link
Collaborator Author

Hi @mohsinbadat , no problem at all! This change has been added to the dev branch of ArchR. This means you can just load in the new ArchR dev branch through remotes::install_github("GreenleafLab/ArchR", ref ="dev")

@mohsinbadat
Copy link

Thanks @immanuelazn that's really helpful! I loaded it and it didn't work first time (R4.4.2, ggplot 3.5.1) but when I loaded ggplot 3.5.0 it's been working a dream, in case this is useful info.

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.

2 participants