Skip to content

Prefer mpl.get_data_path(), and support Paths in FontProperties. #14402

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

Merged
merged 1 commit into from
Jun 3, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 31, 2019

  1. Prefer using mpl.get_data_path() rather than rcParams["datapath"].
    I would like to ultimately kill that rcParams entry, because it
    does not make sense as a rcParam (for example one can't really
    meaningfully assign it to anything else than its default value, or
    set it in their matplotlibrc) and requires e.g. to be blacklisted
    in style/core.py; let's start by not using it in the docs.

  2. As a side effect of that change, one of the examples (font_file.py)
    reads a bit more nicely if one can pass Paths to FontProperties, so
    let's support that.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

Typo in a comment; otherwise, it seems like a good idea.

@@ -13,9 +13,9 @@

It is pretty easy to use, and requires only built-in python libs:

>>> from matplotlib import rcParams
>>> impot matplotlib as mpl
Copy link
Member

Choose a reason for hiding this comment

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

impot -> import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, fixed

@@ -0,0 +1,4 @@
The *fname* argument to `FontProperties` can now be an `os.PathLike`\s
Copy link
Member

Choose a reason for hiding this comment

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

What is the \s doing? I don't recognize it.

Copy link
Member

Choose a reason for hiding this comment

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

The backslash allows you to end intra-word backticks without introducing extra whitespace.

1) Prefer using mpl.get_data_path() rather than rcParams["datapath"].
   I would like to ultimately kill that rcParams entry, because it
   does not make sense as a rcParam (for example one can't really
   meaningfully assign it to anything else than its default value, or
   set it in their matplotlibrc) and requires e.g. to be blacklisted
   in style/core.py; let's start by not using it in the docs.

2) As a side effect of that change, one of the examples (font_file.py)
   reads a bit more nicely if one can pass Paths to FontProperties, so
   let's support that.
@timhoffm timhoffm added this to the v3.2.0 milestone Jun 3, 2019
@timhoffm timhoffm merged commit 2e44c2c into matplotlib:master Jun 3, 2019
@anntzer anntzer deleted the get_data_path branch June 3, 2019 19:47
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.

4 participants