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

Support linewidth aesthetic to control the sizing of the width of lines #742

Open
christophscheuch opened this issue Jan 14, 2024 · 1 comment

Comments

@christophscheuch
Copy link

ggplot2 recommends using the linewidth aesthetic instead of size as of version 3.4.0 (see this blog post here: https://www.tidyverse.org/blog/2022/11/ggplot2-3-4-0/). The argument in the blog post is as follows: "The reason for this change is that prior to this release size was used for two related, but different, properties: the size of points (and glyphs) and the width of lines. Since one is area based and one is length based they fundamentally needs different scaling and the default size scale has always catered to area sizing, using a square root transform. "

Ideally, the following works in plotnine as well (as it does in ggplot2):

from plotnine import *
from palmerpenguins import load_penguins

penguins = load_penguins().dropna()

(ggplot(penguins, aes(x = "body_mass_g", color = "species"))
   + geom_density(linewidth = 0.75)
)
@has2k1
Copy link
Owner

has2k1 commented Jan 15, 2024

Using linewidth for lines is a better option. As that is what matplotlib uses, the only reason for the current state was API compatibility with ggplot2. The plan is to definitely to make that change as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants