Python作図設定例、目盛りのフォント、サイズ、中国語ラベル
2864 ワード
import matplotlib.pyplot as plt
import numpy as np
figure, ax = plt.subplots()
plt.plot(np.arange(1, 11), np.arange(100, 110), label="A", linewidth=5.0)
font = {'family': 'Times New Roman', 'weight': 'normal', 'size': 15}
legend = plt.legend(prop=font)
plt.tick_params(labelsize=20)
labels = ax.get_xticklabels() + ax.get_yticklabels()
[label.set_fontname('Times New Roman') for label in labels]
plt.xlabel("round", font)
plt.ylabel("round", font)
plt.show()
import matplotlib.pyplot as plt
import numpy as np
figure, ax = plt.subplots()
plt.plot(np.arange(1, 11), np.arange(100, 110), label="A", linewidth=5.0)
font = {'family': 'Times New Roman', 'weight': 'normal', 'size': 15}
legend = plt.legend(prop=font)
plt.tick_params(labelsize=20)
labels = ax.get_xticklabels() + ax.get_yticklabels()
[label.set_fontname('Times New Roman') for label in labels]
from matplotlib.font_manager import FontProperties
font=FontProperties(fname=r"C:\windows\fonts\simsun.ttc",size=25)
plt.xlabel(u" ",fontProperties=font)
plt.ylabel(u" ",fontProperties=font)
plt.show()