Skip to main content

A collection of recipes that can be used together with the seaborn library to create custom plots.

Project description

Seaborn Objects Recipes

PyPI Python Versions License CI Docs Code style: Ruff pre-commit

📘 About

seaborn_objects_recipes is a Python package that extends the functionality of the Seaborn library, providing custom recipes for enhanced data visualization. This package includes below features to augment your Seaborn plots with additional capabilities.

[!TIP] For the full gallery and API, see the docs: API-Gallery Docs

📊 Combined Example: Rolling + LOWESS + Direct Line Labels

This example shows how multiple recipes can be layered to clarify noisy time-series data. We generate two synthetic series (sin and cos), apply a short-window rolling mean to smooth local fluctuations, overlay a LOWESS curve to reveal the long-term structure, and add LineLabel to place direct text labels at the right edge of each line.

This pattern is useful when you want:

  • Local smoothing (Rolling) to reduce short-term noise
  • Nonparametric smoothing (Lowess) to reveal global trends
  • Direct labeling (LineLabel) to avoid legends and improve readability in multi-series plots

Together, these transforms produce a clean, interpretable visualization that emphasizes both local variation and overall structure — ideal for exploratory time-series analysis, sensor measurements, economic indicators, or any repeated noisy signal.

    import seaborn.objects as so
    import seaborn_objects_recipes as sor
    import seaborn as sns
    import numpy as np
    import pandas as pd

    # ---- Example data ----
    np.random.seed(42)
    x = np.linspace(0, 10, 200)
    y1 = np.sin(x) + np.random.normal(scale=0.25, size=len(x))
    y2 = np.cos(x) + np.random.normal(scale=0.25, size=len(x))

    df = pd.DataFrame(
        {
            "x": np.tile(x, 2),
            "y": np.concatenate([y1, y2]),
            "series": np.repeat(["sin", "cos"], len(x)),
        }
    )

    (
        so.Plot(df, x="x", y="y", color="series", text="series")
        # Rolling-smoothed line
        .add(so.Line(), rolling := sor.Rolling(window=8, agg="mean"),legend=False,)
        # LOWESS-smoothed line (overlaid)
        .add(so.Line(), sor.Lowess(frac=0.25),legend=False,)
        # Direct labels at the right edge of each series
        .add(sor.LineLabel(offset=8), rolling)
        .layout(size=(10, 4))
        .label(
            title="Smoothed Sin/Cos Time Series with Direct Labels",
            x="x",
            y="Smoothed value",
        )
        .show()
    )

example_plot

⚙️ Installation

To install seaborn_objects_recipes, run the following command:

pip install seaborn_objects_recipes

✉️ Contact

For questions or feedback regarding seaborn_objects_recipes, please contact Ofosu Osei.

🌟 Credits

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

[!IMPORTANT] Quick Checklist:

  • ✅ Distinct x-value count valid for LOWESS (frac ≥ 2/n)
  • ✅ CI columns present (ymin, ymax) when bootstrapping is on
  • ✅ alpha respected and bootstraps defaulted if unset

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seaborn_objects_recipes-0.2.4.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seaborn_objects_recipes-0.2.4-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file seaborn_objects_recipes-0.2.4.tar.gz.

File metadata

  • Download URL: seaborn_objects_recipes-0.2.4.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.2 Darwin/25.3.0

File hashes

Hashes for seaborn_objects_recipes-0.2.4.tar.gz
Algorithm Hash digest
SHA256 3ea0e659b2db5514decb3970446cdaeb8be3444b764be3a6665f3e0325c0e64b
MD5 fc6c76de993b8f914d346ca372f14a67
BLAKE2b-256 407ea6cbcf3d93dae7c5a39eb69aa9cc297ffba86da735789859538f922d300b

See more details on using hashes here.

File details

Details for the file seaborn_objects_recipes-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for seaborn_objects_recipes-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 df360cbaa48e4e761e690570fdd9a9611e198b16c4d4bd8e948113c2c59ac224
MD5 d64bee74654d16c0a5958caf31245b3b
BLAKE2b-256 eaeca1a36287e114511c3b53269dd53f9d85f714028c8f597c0f0a5f0af8d3b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page