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

feat: support facet plot in py-maidr using maidr-ts #148

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

dakshpokar
Copy link
Collaborator

@dakshpokar dakshpokar commented Mar 15, 2025

Description

Note: This doesn't support Seaborn's FacetGrid construction of the plot yet.

Type of Change

  • Bug fix
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@dakshpokar dakshpokar changed the base branch from main to feat/multipanel March 15, 2025 05:27
@jooyoungseo jooyoungseo requested a review from Copilot March 15, 2025 14:05
Copy link

@Copilot Copilot AI left a 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 introduces support for facet plots in py-maidr using the maidr-ts engine and adds several example scripts demonstrating facet plotting with both matplotlib and seaborn. Key changes include:

  • New example scripts for facet plotting with matplotlib and seaborn, including combined bar and line plots.
  • Updates to extractor mixins and plotting modules to improve shared label extraction and data processing for bar and line plots.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
example/facet-subplots/matplotlib/example_mpl_facet_bar_plot.py Adds an example of a matplotlib facet bar plot
example/facet-subplots/seaborn/example_sns_facet_combined_plot.py Adds an example of a combined seaborn facet plot for sales and profit trends
example/facet-subplots/seaborn/example_sns_facet_bar_plot.py Implements a simple facet bar plot example using seaborn
example/facet-subplots/matplotlib/example_mpl_facet_combined_plot.py Adds a matplotlib example combining line and bar plots in facets
maidr/util/mixin/extractor_mixin.py Enhances tick label extraction by adding a fallback for shared x-axes
maidr/core/plot/barplot.py Adjusts handling of bar container data and label mismatches
maidr/core/plot/maidr_plot.py Introduces shared xlabel extraction to improve axis labeling consistency
maidr/core/plot/lineplot.py Filters out default line labels for clearer plot annotations
Comments suppressed due to low confidence (2)

maidr/core/plot/barplot.py:71

  • The commented-out length check between plot elements and their labels may mask data mismatches. Consider either removing the commented code entirely if it is no longer needed or refining the check to ensure that the number of patches always aligns with the extracted labels.
if len(plot) != len(level):

maidr/core/plot/lineplot.py:96

  • Using the hardcoded string "_child0" as a filter for default labels is brittle. Consider extracting this magic string into a well-named constant to improve maintainability and clarity.
line.get_label() if line.get_label() != "_child0" else ""

Copy link
Member

@jooyoungseo jooyoungseo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jooyoungseo
Copy link
Member

@dakshpokar Let's merge this PR once you implement seaborn support and its example.

@dakshpokar
Copy link
Collaborator Author

Sure Professor @jooyoungseo!

Base automatically changed from feat/multipanel to main March 18, 2025 21:39
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

Successfully merging this pull request may close these issues.

2 participants