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

Move plot styling options out of kwargs #70

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

Pennycook
Copy link
Contributor

Before introducing classes like ApplicationStyle, passing all styling options via kwargs made sense. Now that there are effectively separate kwargs lists for different aspects of the plot, those options should be exposed as part of the interface.

Related issues

Closes #46.

Proposed changes

  • Moves styling options out of kwargs.
  • Adds an * to cascade and navchart to separate positional arguments from keyword arguments.
  • Adds documentation for "backend" option that was previously missing.

While working on this I realized an advantage of the matplotlib-style list of kwargs that I hadn't noticed before. With kwargs, it is very easy to define shorthands because everything is just a key in a dictionary (e.g., linestyle and ls refer to the same option).

We should be cognizant of the fact that documenting options like application_style as part of the interface may make it harder to define such shorthands. We might want to adopt shorter names now (e.g., app_style) or maybe find a way to have consistent argument names across cascade and navchart (e.g., style=(PlatformStyle(...), ApplicationStyle(...)))?

I think we can address this in a future PR, but I'm interested in what you think @swright87 and @laserkelvin.

Before introducing classes like ApplicationStyle, passing all styling
options via kwargs made sense. Now that there are effectively separate
kwargs lists for different aspects of the plot, those options should be
exposed as part of the interface.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 16, 2024
@Pennycook Pennycook added this to the 1.0.0 milestone Sep 16, 2024
Copy link
Contributor

@laserkelvin laserkelvin left a comment

Choose a reason for hiding this comment

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

Generally okay with me, brought up two things more for code style than anything

p3analysis/plot/_cascade.py Outdated Show resolved Hide resolved
p3analysis/plot/_navchart.py Outdated Show resolved Hide resolved
Although probably equivalent in this case, using copy.deepcopy() makes
it clearer to the reader that we're performing a copy rather than
casting to a dict.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook merged commit d615e04 into intel:main Sep 19, 2024
7 checks passed
@Pennycook Pennycook deleted the adjust-kwargs branch September 19, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move plot configuration arguments out of kwargs
2 participants