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

Introducing `seaborn_objects_recipes` Library #3738

Open Ofosu-Osei opened 4 months ago

Ofosu-Osei commented 4 months ago

I am excited to introduce a new library we've (@nickeubank) been working on, seaborn_objects_recipes. This library extends seaborn.objects by providing additional functionalities that we hope will be useful for your data visualization needs.

Features The library includes the following recipes:

Example Usage Here's a quick example using the PolyFitWithCI recipes:

import seaborn.objects as so
import seaborn as sns
import seaborn_objects_recipes as sor

    # Load the penguins dataset
    penguins = sns.load_dataset("penguins")

    # Prepare data
    data = penguins.copy()
    data = data[data["species"] == "Adelie"]

    # Create the plot
    plot = (
        so.Plot(data, x="bill_length_mm", y="body_mass_g")
        .add(so.Dot())
        .add(so.Line(), PolyFitWithCI := sor.PolyFitWithCI(order=2, gridsize=100, alpha=0.05))
        .add(so.Band(), PolyFitWithCI)
        .label(x="Bill Length (mm)", y="Body Mass (g)", title="PolyFit Plot with Confidence Intervals")
    )
    # Display Plot
    plot.show()

Output

polyfit_with_ci

Acknowledgements We'd like to acknowledge and thank the following contributors from whom we've borrowed code:

Feedback Request We are looking for feedback on the following:

  1. Integration: Should this library remain a separate extension, or would it be better to roll these features directly into seaborn.objects?
  2. Confidence Intervals: We are particularly interested in feedback on how we're handling confidence intervals in our Lowess and PolyFitWithCI implementations.

You can find the library and more examples on our GitHub repository: seaborn_objects_recipes.

Looking forward to your feedback!

thuiop commented 4 months ago

Sounds nice ! I have some objects I can contribute if you'd like.

nickeubank commented 4 months ago

Sounds nice ! I have some objects I can contribute if you'd like.

Please do! Pulling together all the stuff I think people have been making in their own is precisely the goal!