-
-
Notifications
You must be signed in to change notification settings - Fork 9
[315] Legend groups #349
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
base: main
Are you sure you want to change the base?
[315] Legend groups #349
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #349 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 18 19 +1
Lines 659 701 +42
Branches 85 87 +2
=========================================
+ Hits 659 701 +42
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@codex Review this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds legend grouping functionality to ridgeplot, allowing traces with the same labels to share legend entries. The change introduces a new legendgroup
parameter to control whether traces sharing the same name should be grouped together in the legend.
- Adds a
legendgroup
boolean parameter to control legend entry grouping behavior - Refactors trace creation to use a new
LegendContext
system for managing legend properties - Updates examples and documentation to demonstrate the new legend grouping feature
Reviewed Changes
Copilot reviewed 13 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/ridgeplot/_ridgeplot.py |
Adds legendgroup parameter to main ridgeplot function |
src/ridgeplot/_figure_factory.py |
Integrates LegendContextManager to handle legend grouping logic |
src/ridgeplot/_obj/legendcontext.py |
New module defining legend context management classes |
src/ridgeplot/_obj/traces/base.py |
Refactors trace base class to use LegendContext instead of string labels |
src/ridgeplot/_obj/traces/bar.py |
Updates bar trace implementation to use new legend context system |
src/ridgeplot/_obj/traces/area.py |
Updates area trace implementation to use new legend context system |
tests/unit/test_ridgeplot.py |
Adds test for legend grouping functionality |
tests/unit/test_figure_factory.py |
Updates factory tests to include new legendgroup parameter |
tests/unit/obj/traces/test_bar.py |
Updates bar trace tests to use new LegendContext |
tests/e2e/artifacts/basic_hist.json |
Updates test artifact with new showlegend properties |
docs/getting_started/getting_started.md |
Updates documentation examples to use legendgroup feature |
cicd_utils/ridgeplot_examples/_lincoln_weather.py |
Updates example to demonstrate legendgroup usage |
cicd_utils/ridgeplot_examples/_lincoln_weather_red_blue.py |
Updates color mapping to use new label names |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
trace_type: TraceTypesArray | ShallowTraceTypesArray | TraceType | None = None, | ||
labels: LabelsArray | ShallowLabelsArray | None = None, | ||
row_labels: Collection[str] | None | Literal[False] = None, | ||
legendgroup: bool = False, # TODO: document and rename to smth better! |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO comment suggests this parameter needs documentation and a better name. The current name 'legendgroup' and the boolean type don't clearly convey that this enables grouping of legend entries by label name.
Copilot uses AI. Check for mistakes.
# FIXME: This doesn't seem to work as expected | ||
# legendgrouptitle=Legendgrouptitle(text=label), |
Copilot
AI
Oct 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented FIXME indicates that legendgrouptitle functionality is not working as expected. This suggests there may be an issue with the Plotly legend group title feature that should be investigated or documented.
Copilot uses AI. Check for mistakes.
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting |
@codex pick a better name for the new parameter and document it in the ridgeplot docstring |
Summary
Testing
|
Closes #315
📚 Documentation preview 📚: https://ridgeplot--349.org.readthedocs.build/en/349/