From 83e47e31735523e00b9fcb459426fe1213efb9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=AD=E6=A2=81?= Date: Tue, 2 Jan 2018 19:57:38 +0800 Subject: [PATCH] ignore chinese code question --- python_visual.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/python_visual.py b/python_visual.py index 32661a4..c6dbb50 100644 --- a/python_visual.py +++ b/python_visual.py @@ -12,8 +12,8 @@ import matplotlib.font_manager as fm from mpl_toolkits.mplot3d import Axes3D # 解决中文乱码问题 -myfont = fm.FontProperties(fname="/Library/Fonts/Songti.ttc", size=14) -matplotlib.rcParams["axes.unicode_minus"] = False +# myfont = fm.FontProperties(fname="/Library/Fonts/Songti.ttc", size=14) +# matplotlib.rcParams["axes.unicode_minus"] = False def simple_plot(): @@ -26,16 +26,19 @@ def simple_plot(): # 生成画布,并设定标题 plt.figure(figsize=(8, 6), dpi=80) - plt.title("简单曲线图", fontproperties=myfont) + # plt.title("简单曲线图", fontproperties=myfont) + plt.title("简单曲线图") plt.grid(True) # 设置X轴 - plt.xlabel("X轴", fontproperties=myfont) + # plt.xlabel("X轴", fontproperties=myfont) + plt.xlabel("X轴") plt.xlim(-4.0, 4.0) plt.xticks(np.linspace(-4, 4, 9, endpoint=True)) # 设置Y轴 - plt.ylabel("Y轴", fontproperties=myfont) + # plt.ylabel("Y轴", fontproperties=myfont) + plt.ylabel("Y轴") plt.ylim(-1.0, 1.0) plt.yticks(np.linspace(-1, 1, 9, endpoint=True)) @@ -44,7 +47,7 @@ def simple_plot(): plt.plot(x, y_sin, "g-", linewidth=2.0, label="sin示例") # 设置图例位置,loc可以为[upper, lower, left, right, center] - plt.legend(loc="upper left", prop=myfont, shadow=True) + # plt.legend(loc="upper left", prop=myfont, shadow=True) # 图形显示 plt.show() @@ -500,3 +503,5 @@ def three_dimension_bar(): plt.show() return # three_dimension_bar() + +simple_plot()