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 highlight in line, bar and histogram plots using maidr-ts #153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dakshpokar
Copy link
Collaborator

Description

This PR adds highlight support in py-maidr when using maidr-ts engine for line, bar and histogram plots. Also, there is no support for multiline plots with this PR 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

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 highlighting in line, bar, and histogram plots when using the maidr-ts engine. Key changes include:

  • Updating the line plot’s _get_selector method return type from a string to a list of strings.
  • Adjusting schema handling in maidr.py to process both string and list types for selectors.
  • Renaming the MaidrKey “selector” to “selectors” to better reflect the new data structure.

Reviewed Changes

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

Show a summary per file
File Description
maidr/core/plot/lineplot.py Changed _get_selector to return a list of selectors instead of a single string.
maidr/core/maidr.py Added type checks to handle both string and list selectors and update them accordingly.
maidr/core/enum/maidr_key.py Renamed the key from "selector" to "selectors" to align with the updated usage.
example/line/seaborn/example_sns_line.py Modified to set the engine to “ts” for the highlight support demonstration.
example/line/matplotlib/example_mpl_line.py Updated the maidr engine setting to “ts” by uncommenting the command.
example/bar/seaborn/example_sns_bar_plot.py Added the ts engine setting for consistency in the bar plot example.
example/bar/matplotlib/example_mpl_bar_plot.py Enabled the ts engine setting by removing the commented command.
Comments suppressed due to low confidence (3)

maidr/core/plot/lineplot.py:45

  • Changing the return type from a string to a list may require ensuring that all consumers of _get_selector handle a list appropriately. Verify that this change does not break downstream functionalities expecting a string.
def _get_selector(self) -> list[str]:

maidr/core/enum/maidr_key.py:8

  • [nitpick] Renaming the key to "selectors" suggests that a selector list is expected; consider updating any related docstrings or inline comments for clarity on the intended usage.
SELECTOR = "selectors"

maidr/core/maidr.py:169

  • [nitpick] Consider refactoring the loop that iterates over selectors for improved readability, for example by using enumerate or a list comprehension, if such a change aligns with the project's style guidelines.
if isinstance(schema[MaidrKey.SELECTOR], list):

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