mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.6k stars 1.93k forks source link

Fix mark width for overlapping data (#3769) #3770

Open maurosilber opened 1 month ago

maurosilber commented 1 month ago

This could be a fix for #3769, where the bin width for overlapping histograms is smaller than the actual bin width.

It renames "space" to "width" in so.Hist's calculated properties, and only applies extra scaling to the default width.

A possibly unintended consecuence is that it changes the look for so.Bar(), so.Hist() which used to look like so.Bar(), so.Count():

import seaborn as sns
import seaborn.objects as so

penguins = sns.load_dataset("penguins").dropna()

(
    so.Plot(penguins, x="species")
    .add(so.Bar(), so.Hist(), label="Hist")
    .add(so.Bar(color="C1"), so.Count(), label="Count")
)

image