has2k1 / has2k1/plotnine

Support `linewidth` aesthetic to control the sizing of the width of lines

Open
#742 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Python
Stars
4.8k
Forks
254
Avg merge
10h 35m
Merged PRs (30d)
9

Description

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)
)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names the geom_density example but no source file or test path. Start by tracing how plotnine handles the existing size aesthetic for line geoms, then compare the requested linewidth behavior with the linked ggplot2 guidance. Done means the supplied example accepts linewidth=0.75 and uses it to control density line width.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.