Skip to content

Manual and identity scales for linewidth #5136

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

Merged
merged 4 commits into from
Jan 9, 2023

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5050.

It does so by adding identity and manual scales, according to the patterns that were used for other aesthetics.
I could add some very basic tests, but I was unsure whether these would be necessary, as most other aesthetics also don't have such tests.

Some visual examples:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

p <- ggplot(economics_long, aes(date, value01, group = variable))

p + geom_line(aes(linewidth = variable)) +
  scale_linewidth_manual(values = c(3,2,1,2,3))

p + geom_line(aes(linewidth = rescale(date))) +
  scale_linewidth_identity(guide = 'legend')

Created on 2023-01-06 by the reprex package (v2.0.1)

@thomasp85 thomasp85 added this to the ggplot2 3.4.1 milestone Jan 9, 2023
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand teunbrand merged commit a8f5581 into tidyverse:main Jan 9, 2023
@teunbrand teunbrand deleted the missing_linewidth_scales branch January 9, 2023 19:45
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.

Would scale_linewidth_discrete() be developed to set values manually like other scale_size_manual()
2 participants