FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

LaTeX axis labels can no longer have custom fonts · Issue #6514 · matplotlib/matplotlib · GitHub

Repository navigation

LaTeX axis labels can no longer have custom fonts #6514

Closed

Description

This happens in matplotlib 2.0b1. Here's an example that triggers this behavior:

https://gist.github.com/ngoldbaum/67cf464cc1e2763f95808759423943d9

And this is what the resulting image looks like:

Here's what the image produced by the exact same script run under matplotlib 1.5.1 looks like:

Note how in matplotlib 1.5.1 the y axis label is drawn using the font I specify in the script (stixgeneral). Under matplotlib 2.0b1, the font is unconditionally set to the default matplotlib font no matter what I do.

This underlying issue is currently causing some labels in yt plots to be rendered with the incorrect font under matplotlib 2.0b1.

Activity

  1. added this to the milestone on May 31, 2016
  2. ngoldbaum commented on May 31, 2016

    ContributorAuthor

    Spent a little bit of time digging into matplotlib internals. It's easiest to see a difference by looking at the render_glyph method of the Fonts object, defined in mathtext.py.

    Under matplotlib 1.5.1, the call to _get_info inside render_glyph returns a font object with the following filename on my setup:

    /Users/goldbaum/Documents/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf

    While on matplotlib 2.0b1, it returns a font object with the following filename:

    /Users/goldbaum/Documents/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf

    So it looks like the real issue is that mathtext used to be rendered in a serif computer modern font by default, but now defaults to a sans-serif DejaVuSans font.

    Is there a way to modify the script I linked to in the issue description to pick out the computer modern font matplotlib used to use?

  3. ngoldbaum commented on May 31, 2016

    ContributorAuthor

    ping @zblz @mdboom since they appear to be the ones who have worked on these code paths in mathtext.

  4. ngoldbaum commented on May 31, 2016

    ContributorAuthor

    More precisely, is there a way to set the font used by matplotlib for mathtext rendering using the object-oriented interface? I don't think I can do this by setting rcparams, as suggested in the docs, since this is in the context of a library depending on matplotlib rather a user script making use of matplotlib.

  5. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on May 31, 2016
  6. ngoldbaum commented on Jun 1, 2016

    ContributorAuthor

    I'm going to close this and open another issue with a feature request about controlling mathtext fonts via the OO API.

  7. mdboom commented on Jun 1, 2016

    Member

    I don't think I can do this by setting rcparams, as suggested in the docs, since this is in the context of a library depending on matplotlib rather a user script making use of matplotlib.

    Indeed there's no way other than setting an rcParam at present. You can, however, use the rcParam context manager to change it to what you need and then automatically change it back.

  8. WeatherGod commented on Jun 1, 2016

    Member

    IIRC, it is possible to pass in a dictionary to the context manager rather
    than a style filename... right?

    On Wed, Jun 1, 2016 at 8:32 AM, Michael Droettboom <notifications@github.com

    wrote:

    I don't think I can do this by setting rcparams, as suggested in the docs,
    since this is in the context of a library depending on matplotlib rather a
    user script making use of matplotlib.

    Indeed there's no way other than setting an rcParam at present. You can,
    however, use the rcParam context manager to change it to what you need and
    then automatically change it back.

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #6514 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AARy-B-1wfnG1MzNvqcA0T9HxpkGndk0ks5qHXvqgaJpZM4IquLl
    .

  9. mdboom commented on Jun 1, 2016

    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: text

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL