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

[Bug]: Font-Fallback implemented in 3.6.0 does not work for title or labels · Issue #23992 · matplotlib/matplotlib · GitHub

Repository navigation

[Bug]: Font-Fallback implemented in 3.6.0 does not work for title or labels #23992

Closed

Description

Bug summary

Font-Fallback implemented in #20740 does not work for title or labels.

Code for reproduction

import matplotlib.pyplot as plt


def plot_graph():
    fig, ax = plt.subplots(figsize=(6, 3))
    text = 'There are 多个汉字 👈👉 in between!'
    plt.rcParams['font.family'] = ['Segoe UI Emoji', 'SimHei']
    plt.figtext(0.3, 0.7, text)
    plt.title(text)
    plt.xlabel(text)
    plt.ylabel(text)
    plt.show()


plot_graph()

Actual outcome

Expected outcome

Title and labels should be displayed correctly like the figtext.

Additional information

No response

Operating system

Windows

Matplotlib Version

3.6.0

Matplotlib Backend

TkAgg

Python version

3.10.7

Jupyter version

No response

Installation

pip

Activity

  1. changed the title [-][Bug]: Font-Fallback implemented in 3.6.0 does not work for title[/-] [+][Bug]: Font-Fallback implemented in 3.6.0 does not work for title or labels[/+] on Sep 24, 2022
  2. anzhi0708 commented on Sep 24, 2022

    Same, macOS 12.3

  3. QuLogic commented on Sep 24, 2022

    Member
        fig, ax = plt.subplots(figsize=(6, 3))
        text = 'There are 多个汉字 👈👉 in between!'
        plt.rcParams['font.family'] = ['Segoe UI Emoji', 'SimHei']

    That's because you set the rcParam after creating the figure. The same thing would happen to the other text if you put it after figtext as well.

    You need to set the rcParam before calling plt.subplots.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL