通过rcParams设置字体时,例如
import matplotlib as mpl
mpl.rcParams['font.sans-serif'] = ['FreeSans', ]
对数图的字体不变。而是保留默认字体类型。你知道吗
import matplotlib.pyplot as plt
from numpy import arange
plt.ion()
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212)
for n in range(1, 10):
ax1.plot(range(1, 10), arange(1, 10)**n, label='poly{}'.format(n))
ax2.plot(range(1, 10), arange(1, 10)**n, label='poly{}'.format(n))
ax1.set_xscale('log')
ax1.set_yscale('log')
ax2.legend(ncol=2);
我想知道有没有办法设置科学的字体类型?你知道吗
(勾选两个图中的“一”可以看到不同的字体。)
对我来说,将mathtext字体集更改为“custom”成功了:
相关问题 更多 >
编程相关推荐