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

Introducing seaborn_objects_recipes Library #3738

Open
Ofosu-Osei opened this issue Jul 25, 2024 · 2 comments
Open

Introducing seaborn_objects_recipes Library #3738

Ofosu-Osei opened this issue Jul 25, 2024 · 2 comments

Comments

@Ofosu-Osei
Copy link

Ofosu-Osei commented Jul 25, 2024

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:

  • Rolling: Apply rolling window calculations to your data.
  • LineLabel: Add labels directly to your lines for better readability.
  • Lowess: Perform locally-weighted regression smoothing, with support for confidence intervals.
  • PolyFitWithCI: Fit polynomial regression models and include confidence intervals.

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
Copy link
Contributor

thuiop commented Jul 25, 2024

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

@nickeubank
Copy link

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!

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

No branches or pull requests

3 participants