Font-Fallback implemented in #20740 does not work for title or labels.
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()
Title and labels should be displayed correctly like the figtext.
No response
Windows
3.6.0
TkAgg
3.10.7
pip
Same, macOS 12.3
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.
Activity
anzhi0708 commented on Sep 24, 2022
Same, macOS 12.3
QuLogic commented on Sep 24, 2022
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.