From 27fb0e051c6b1ed1e07f2c736122f226b659578e Mon Sep 17 00:00:00 2001 From: guanjihuan <34735497+guanjihuan@users.noreply.github.com> Date: Thu, 9 Sep 2021 19:17:44 +0800 Subject: [PATCH] update --- .../2020.12.23_plot_with_matplotlib/plot_3D_surface.py | 3 +-- .../2020.12.23_plot_with_matplotlib/plot_contour.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/language_learning/2020.12.23_plot_with_matplotlib/plot_3D_surface.py b/language_learning/2020.12.23_plot_with_matplotlib/plot_3D_surface.py index 79da877..b356497 100644 --- a/language_learning/2020.12.23_plot_with_matplotlib/plot_3D_surface.py +++ b/language_learning/2020.12.23_plot_with_matplotlib/plot_3D_surface.py @@ -33,8 +33,7 @@ def Plot_3D_Surface(x,y,matrix,filename='a.jpg', titlename='Plot 3D Surface'): cax = plt.axes([0.75, 0.15, 0.05, 0.75]) # color bar的位置 [左,下,宽度, 高度] cbar = fig.colorbar(surf, cax=cax) # color bar cbar.ax.tick_params(labelsize=15) # 设置color bar刻度的字体大小 - for l in cbar.ax.yaxis.get_ticklabels(): # 设置color bar刻度的字体 - l.set_family('Times New Roman') + [l.set_family('Times New Roman') for l in cbar.ax.yaxis.get_ticklabels()] # 设置color bar刻度的字体 # plt.savefig(filename, dpi=800) # 保存图片文件 plt.show() plt.close('all') # 关闭所有plt,防止循环画图时占用内存 diff --git a/language_learning/2020.12.23_plot_with_matplotlib/plot_contour.py b/language_learning/2020.12.23_plot_with_matplotlib/plot_contour.py index a5cc63d..c10b30b 100644 --- a/language_learning/2020.12.23_plot_with_matplotlib/plot_contour.py +++ b/language_learning/2020.12.23_plot_with_matplotlib/plot_contour.py @@ -31,8 +31,7 @@ def Plot_Contour(x,y,matrix,filename='a.jpg', titlename='Plot Contour'): cax = plt.axes([0.75, 0.15, 0.08, 0.73]) # color bar的位置 [左,下,宽度, 高度] cbar = fig.colorbar(contour, cax=cax) # color bar cbar.ax.tick_params(labelsize=15) # 设置color bar刻度的字体大小 - for l in cbar.ax.yaxis.get_ticklabels(): # 设置color bar刻度的字体 - l.set_family('Times New Roman') + [l.set_family('Times New Roman') for l in cbar.ax.yaxis.get_ticklabels()] # 设置color bar刻度的字体 # plt.savefig(filename, dpi=800) # 保存图片文件 plt.show() plt.close('all') # 关闭所有plt,防止循环画图时占用内存