From 1a7da6044e061fcb4b8d17ae14f3719f8451ef8e Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:43:43 -0500 Subject: [PATCH 1/3] fix collections usage in NCL_hov_3.py --- Gallery/Contours/NCL_hov_3.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Gallery/Contours/NCL_hov_3.py b/Gallery/Contours/NCL_hov_3.py index 0151a8f6e..626396b3c 100644 --- a/Gallery/Contours/NCL_hov_3.py +++ b/Gallery/Contours/NCL_hov_3.py @@ -67,14 +67,7 @@ levels=np.arange(-6, 12, 2), colors='black', linestyles="-", - linewidths=.2) - -# Set 0 level contour line to a thicker linewidth -# If you try to access the "levels" attribute of cs (cs.levels), -# the list of levels is: [-6, -4, -2, 0, 2, 4, 6, 8, 10] -# level 0 is at the 3rd index of that list, so those contour lines -# can be accessed at cs.collections[3] -cs.collections[3].set_linewidth(1) + linewidths=[.2,.2,.2,1,.2,.2,.2,.2,.2]) # Label the contour levels -4, 0, and 4 cl = ax.clabel(cs, fmt='%d', levels=[-4, 0, 4]) From 16b58c5eeae8ec28e0b32809e7461788a6f34435 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:51:24 -0500 Subject: [PATCH 2/3] changes in NCL_coneff_11.py to support MPL changes to ContourSet --- Gallery/Contours/NCL_coneff_11.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Gallery/Contours/NCL_coneff_11.py b/Gallery/Contours/NCL_coneff_11.py index 727349b4c..38a1acd9e 100644 --- a/Gallery/Contours/NCL_coneff_11.py +++ b/Gallery/Contours/NCL_coneff_11.py @@ -59,9 +59,8 @@ cmap='white') # Use white cmap to have a white background # Set the colors for the hatches -for i, collection in enumerate(p.collections): - collection.set_edgecolor(colors[i % len(colors)]) - collection.set_linewidth(0.) +p.set_edgecolors(colors) +p.set_linewidth(0.) # Set linewidth of hatches plt.rcParams['hatch.linewidth'] = 2.5 From 52bc29db2b8feb13e55999ca2535a72bfe3e19ff Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:56:40 -0500 Subject: [PATCH 3/3] formatting --- Gallery/Contours/NCL_hov_3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gallery/Contours/NCL_hov_3.py b/Gallery/Contours/NCL_hov_3.py index 626396b3c..ecd7e4c24 100644 --- a/Gallery/Contours/NCL_hov_3.py +++ b/Gallery/Contours/NCL_hov_3.py @@ -67,7 +67,7 @@ levels=np.arange(-6, 12, 2), colors='black', linestyles="-", - linewidths=[.2,.2,.2,1,.2,.2,.2,.2,.2]) + linewidths=[.2, .2, .2, 1, .2, .2, .2, .2, .2]) # Label the contour levels -4, 0, and 4 cl = ax.clabel(cs, fmt='%d', levels=[-4, 0, 4])