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

Update geoms to handle upcoming {ggplot2} linewidth/size changes #82

Closed
trevorld opened this issue Jun 17, 2022 · 2 comments · Fixed by #84
Closed

Update geoms to handle upcoming {ggplot2} linewidth/size changes #82

trevorld opened this issue Jun 17, 2022 · 2 comments · Fixed by #84
Assignees
Labels
enhancement New feature or request

Comments

@trevorld
Copy link
Owner

According to a twitter thread from Thomas Lin Pedersen:

Substitute all references to the "size" column in the data with a reference to "linewidth" while falling back to "size" (so that your code works prior to the next release of ggplot2). Example:

data$size

changes to

data$linewidth %||% data$size

Add a new field to your ggproto Geom class:

rename_size = TRUE

(this takes care of converting incoming size aesthetics to linewidth and hooking it up with the correct scale etc)

That's it! As a minimal example see geom_rect: https://github.com/tidyverse/ggplot2/blob/main/R/geom-rect.r

@trevorld trevorld added the enhancement New feature or request label Jun 17, 2022
@trevorld trevorld self-assigned this Jun 17, 2022
@trevorld
Copy link
Owner Author

I'm not observing that a "reference to 'linewidth' while falling back to 'size' (so that your code works prior to the next release of ggplot2)" e.g. data$linewidth %||% data$size actually gets our code to work with ggplot2 3.3.6 when trying to use a size aesthetic instead of linewidth.

However if we get our code to work with the development version of ggplot2 we could simply bump our version requirement for {ggplot2} in our DESCRIPTION file...

@trevorld
Copy link
Owner Author

trevorld commented Jun 19, 2022

Next version of {ggplot2} is intended to be released "at least before the end of the summer": tidyverse/ggplot2#4854

Not clear to if this will be a breaking change for geoms that now use both size and linewidth like geom_sf_pattern(): tidyverse/ggplot2#4883

trevorld added a commit that referenced this issue Jun 20, 2022
* In line with upstream changes in `{ggplot2}` a `linewidth` aesthetic has been introduced and supersedes the `size` aesthetic for scaling the width of patterned area border lines (#82).
 `size` will remain functioning but deprecated for these geoms and it is recommended to update all code to reflect the new aesthetic.
  Continue to use the `size` aesthetic to adjust the size of any *points* in `geom_sf_pattern()` (and any other geoms which also have points).

closes #82
trevorld added a commit that referenced this issue Aug 25, 2022
* In line with upstream changes in `{ggplot2}` a `linewidth` aesthetic has been introduced and supersedes the `size` aesthetic for scaling the width of patterned area border lines (#82).
 `size` will remain functioning but deprecated for these geoms and it is recommended to update all code to reflect the new aesthetic.
  Continue to use the `size` aesthetic to adjust the size of any *points* in `geom_sf_pattern()` (and any other geoms which also have points).

closes #82
trevorld added a commit that referenced this issue Aug 30, 2022
* In line with upstream changes in `{ggplot2}` a `linewidth` aesthetic has been introduced and supersedes the `size` aesthetic for scaling the width of patterned area border lines (#82).
 `size` will remain functioning but deprecated for these geoms and it is recommended to update all code to reflect the new aesthetic.
  Continue to use the `size` aesthetic to adjust the size of any *points* in `geom_sf_pattern()` (and any other geoms which also have points).

closes #82
trevorld added a commit that referenced this issue Aug 30, 2022
* In line with upstream changes in `{ggplot2}` a `linewidth` aesthetic has been introduced and supersedes the `size` aesthetic for scaling the width of patterned area border lines (#82).
 `size` will remain functioning but deprecated for these geoms and it is recommended to update all code to reflect the new aesthetic.
  Continue to use the `size` aesthetic to adjust the size of any *points* in `geom_sf_pattern()` (and any other geoms which also have points).

closes #82
trevorld added a commit that referenced this issue Nov 8, 2022
* In line with upstream changes in `{ggplot2}` a `linewidth` aesthetic has been introduced and supersedes the `size` aesthetic for scaling the width of patterned area border lines (#82).
 `size` will remain functioning but deprecated for these geoms and it is recommended to update all code to reflect the new aesthetic.
  Continue to use the `size` aesthetic to adjust the size of any *points* in `geom_sf_pattern()` (and any other geoms which also have points).

closes #82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant