Skip to content

edited 2D Object to add labelfont alias so that tick_params can direc… #19110

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

the-msmathew
Copy link

@the-msmathew the-msmathew commented Dec 14, 2020

…tly have kward to set label fonts

PR Summary

Based on new feature request from, #18425
In order to complete these, I added another kwarg keyword, 'labelfont' in the Line2D object in matplotlib/lines.py and added relevant getter/setter functions. A keyword was also added in axis.py where parameters are actually applied.

This will allow a user to call tick_params and set the font family separate from the rest of the text on the figure without having to also invoke set_ylabels using axes.

PR Checklist

  • [- ] Has pytest style unit tests (and pytest passes).
  • [- ] Is Flake 8 compliant (run flake8 on changed files to check).
  • [ -] New features are documented, with examples if plot related.
  • [ -] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [ -] Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [ -] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [ -] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymak
Copy link
Member

jklymak commented Dec 14, 2020

Thanks for this. Seems reasonable on a first look. Can you curate the PR description a bit? Also why is _invalidy being set in the setter?

@the-msmathew
Copy link
Author

the-msmathew commented Dec 14, 2020

The 'invalidy = True' was a misstep based on the previous fcn definition. I can remove that. By 'curate the PR description', does that mean give more detail on the 'PR Summary' above? If so, I added more detail, but if there's different types of details I should add, I can go ahead and do so.

@jklymak
Copy link
Member

jklymak commented Dec 14, 2020

There are about 12,000 examples to choose from ;-)

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Welcome to Matplotlib, and thanks for the contribution! IMHO the PR description is fine now.

What I don't understand: Why do you have to add a font property to Lines2D. That seems quite odd as lines conceptually do not have a font.

Looking a bit into it, you need to add an explcit parameter labelfont to the class Tick instead of Line2D, and use that to modify the created Text (self.label1 = mtext.Text(...), self.label2 = mtext.Text(...)) - analogous to labelsize and labelcolor.

@the-msmathew
Copy link
Author

Intuitively, that makes sense. When I originally added a nonexistent kwarg to tick_params to see where the function calls would take me, it seemed like the error eventually occurred where I edited the files as part of the Line2D Object. Thank you for the feedback and I can make edits in the Tick class instead if that's better for maintainability.

@dopplershift dopplershift linked an issue Dec 15, 2020 that may be closed by this pull request
@jklymak jklymak marked this pull request as draft May 11, 2021 00:05
@github-actions
Copy link

Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it.

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Waiting for author
Development

Successfully merging this pull request may close these issues.

Add fontfamily/labelfont to tick_params
4 participants