带有 seaborn 的 Matplotlib 不显示西里尔符号
Matplotlib with seaborn doesn't show cyrillic symbols
我尝试创建一些图并另存为 pdf:
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import seaborn as sns
...
pp = PdfPages('filename.pdf')
sns.set_style("whitegrid")
fig, ax = plt.subplots(figsize=(20, 15))
...
pp.savefig()
它在 Ubuntu 18.04 的 DO droplet 上运行良好,但它在另一台 Ubuntu 18.04 的 KVM 机器上没有显示所有西里尔符号(标题、标签),没有错误或警告。没有行 sns.set_style("whitegrid")
它在两台机器上工作相同。
我可以从哪里开始挖掘?
python= 3.6.9.
matplotlib==3.1.2
numpy==1.18.0
pandas==0.25.3
scipy==1.4.1
seaborn==0.9.0
This file 是预定义的 "whitegrid" 样式 - 它可能是字体定义:
font.family: sans-serif
font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
您可能 override font.sans-serif
使用具有正常工作的西里尔字母的字体(也许查看工作配置的 sns.axes_style()
输出)。
我尝试创建一些图并另存为 pdf:
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import seaborn as sns
...
pp = PdfPages('filename.pdf')
sns.set_style("whitegrid")
fig, ax = plt.subplots(figsize=(20, 15))
...
pp.savefig()
它在 Ubuntu 18.04 的 DO droplet 上运行良好,但它在另一台 Ubuntu 18.04 的 KVM 机器上没有显示所有西里尔符号(标题、标签),没有错误或警告。没有行 sns.set_style("whitegrid")
它在两台机器上工作相同。
我可以从哪里开始挖掘?
python= 3.6.9.
matplotlib==3.1.2
numpy==1.18.0
pandas==0.25.3
scipy==1.4.1
seaborn==0.9.0
This file 是预定义的 "whitegrid" 样式 - 它可能是字体定义:
font.family: sans-serif
font.sans-serif: Arial, Liberation Sans, DejaVu Sans, Bitstream Vera Sans, sans-serif
您可能 override font.sans-serif
使用具有正常工作的西里尔字母的字体(也许查看工作配置的 sns.axes_style()
输出)。