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

Implement functionality to plot multiple traces per row #114

Merged
merged 33 commits into from
Aug 11, 2023

Conversation

tpvasconcelos
Copy link
Owner

@tpvasconcelos tpvasconcelos commented Jun 22, 2023

solves #77

Example plot with multiple traces per row:

image

Sample code:

import numpy as np
from ridgeplot import ridgeplot
from ridgeplot.datasets import load_lincoln_weather

# Load test data
df = load_lincoln_weather()

# Transform the data into a 3D (ragged) array format of
# daily min and max temperature samples per month
months = df.index.month_name().unique()
samples = [
    [
        df[df.index.month_name() == month]["Min Temperature [F]"],
        df[df.index.month_name() == month]["Max Temperature [F]"],
    ]
    for month in months
]

# And finish by styling it up to your liking!
fig = ridgeplot(
    samples=samples,
    labels=months,
    coloralpha=0.98,
    bandwidth=4,
    kde_points=np.linspace(-25, 110, 400),
    spacing=0.33,
    linewidth=2,
)
fig.update_layout(
    title="Minimum and maximum daily temperatures in Lincoln, NE (2016)",
    height=650,
    width=950,
    font_size=14,
    plot_bgcolor="rgb(245, 245, 245)",
    xaxis_gridcolor="white",
    yaxis_gridcolor="white",
    xaxis_gridwidth=2,
    yaxis_title="Month",
    xaxis_title="Temperature [F]",
    showlegend=False,
)
fig.show()

docs/conf.py Outdated Show resolved Hide resolved
docs/conf.py Outdated Show resolved Hide resolved
examples/readme_simple.py Outdated Show resolved Hide resolved
src/ridgeplot/_ridgeplot.py Outdated Show resolved Hide resolved
src/ridgeplot/_types.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2023

Codecov Report

Patch coverage: 58.56% and project coverage change: -2.69% ⚠️

Comparison is base (4843011) 65.63% compared to head (197a67f) 62.95%.
Report is 1 commits behind head on main.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
- Coverage   65.63%   62.95%   -2.69%     
==========================================
  Files          11       11              
  Lines         259      386     +127     
  Branches       43       65      +22     
==========================================
+ Hits          170      243      +73     
- Misses         89      140      +51     
- Partials        0        3       +3     
Flag Coverage Δ
unittests 62.95% <58.56%> (-2.69%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/ridgeplot/_ridgeplot.py 27.77% <29.16%> (-11.12%) ⬇️
src/ridgeplot/_figure_factory.py 32.81% <36.55%> (+9.64%) ⬆️
src/ridgeplot/_utils.py 71.11% <40.90%> (-28.89%) ⬇️
src/ridgeplot/datasets/__init__.py 70.58% <69.23%> (-29.42%) ⬇️
src/ridgeplot/_kde.py 75.00% <70.83%> (+41.66%) ⬆️
src/ridgeplot/_colors.py 96.61% <86.66%> (-3.39%) ⬇️
src/ridgeplot/_testing.py 88.88% <87.50%> (-11.12%) ⬇️
src/ridgeplot/_types.py 98.18% <98.03%> (+3.18%) ⬆️
src/ridgeplot/__init__.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tpvasconcelos tpvasconcelos added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 11, 2023
@tpvasconcelos tpvasconcelos added dependencies Upgrade and lock dependencies CI Related to CI checks labels Aug 11, 2023
@tpvasconcelos tpvasconcelos marked this pull request as ready for review August 11, 2023 16:48
@tpvasconcelos tpvasconcelos merged commit ddc4f18 into main Aug 11, 2023
14 of 15 checks passed
@tpvasconcelos tpvasconcelos deleted the multi-trace branch August 11, 2023 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Related to CI checks dependencies Upgrade and lock dependencies documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants