1212from mpl_toolkits .mplot3d import Axes3D
1313
1414# 解决中文乱码问题
15- myfont = fm .FontProperties (fname = "/Library/Fonts/Songti.ttc" , size = 14 )
16- matplotlib .rcParams ["axes.unicode_minus" ] = False
15+ # myfont = fm.FontProperties(fname="/Library/Fonts/Songti.ttc", size=14)
16+ # matplotlib.rcParams["axes.unicode_minus"] = False
1717
1818
1919def simple_plot ():
@@ -26,16 +26,19 @@ def simple_plot():
2626
2727 # 生成画布,并设定标题
2828 plt .figure (figsize = (8 , 6 ), dpi = 80 )
29- plt .title ("简单曲线图" , fontproperties = myfont )
29+ # plt.title("简单曲线图", fontproperties=myfont)
30+ plt .title ("简单曲线图" )
3031 plt .grid (True )
3132
3233 # 设置X轴
33- plt .xlabel ("X轴" , fontproperties = myfont )
34+ # plt.xlabel("X轴", fontproperties=myfont)
35+ plt .xlabel ("X轴" )
3436 plt .xlim (- 4.0 , 4.0 )
3537 plt .xticks (np .linspace (- 4 , 4 , 9 , endpoint = True ))
3638
3739 # 设置Y轴
38- plt .ylabel ("Y轴" , fontproperties = myfont )
40+ # plt.ylabel("Y轴", fontproperties=myfont)
41+ plt .ylabel ("Y轴" )
3942 plt .ylim (- 1.0 , 1.0 )
4043 plt .yticks (np .linspace (- 1 , 1 , 9 , endpoint = True ))
4144
@@ -44,7 +47,7 @@ def simple_plot():
4447 plt .plot (x , y_sin , "g-" , linewidth = 2.0 , label = "sin示例" )
4548
4649 # 设置图例位置,loc可以为[upper, lower, left, right, center]
47- plt .legend (loc = "upper left" , prop = myfont , shadow = True )
50+ # plt.legend(loc="upper left", prop=myfont, shadow=True)
4851
4952 # 图形显示
5053 plt .show ()
@@ -500,3 +503,5 @@ def three_dimension_bar():
500503 plt .show ()
501504 return
502505# three_dimension_bar()
506+
507+ simple_plot ()
0 commit comments