From 0f9081e64fccb2035e4f4ae7206bfb8771eb4ba8 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:04:48 -0600 Subject: [PATCH 1/3] Update NCL_xy_16.py to use the "reverse" option for the legend rather than a workaround --- Gallery/XY/NCL_xy_16.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Gallery/XY/NCL_xy_16.py b/Gallery/XY/NCL_xy_16.py index c17ca6c37..ae5e85ae8 100644 --- a/Gallery/XY/NCL_xy_16.py +++ b/Gallery/XY/NCL_xy_16.py @@ -96,15 +96,14 @@ # Add legend handles, labels = ax.get_legend_handles_labels() -# Default order is the order in which the data was plotted -handles = reversed(handles) # Reverse order of legend elements -labels = reversed(labels) + plt.legend(handles, labels, loc='center right', frameon=False, fontsize=14, - labelspacing=1) + labelspacing=1, + reverse=True) plt.show() @@ -183,13 +182,13 @@ # Add legend handles, labels = ax.get_legend_handles_labels() # Default order is the order in which the data was plotted -handles = reversed(handles) # Reverse order of legend elements -labels = reversed(labels) + plt.legend(handles, labels, loc='center right', frameon=False, fontsize=14, - labelspacing=1) + labelspacing=1, + reverse=True) plt.show() From b9f57341c4ba85389c46fe382562ce49922acf18 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:08:12 -0600 Subject: [PATCH 2/3] Update NCL_overlay_11b.py to address matplotlib 3.10 changes --- Gallery/Overlays/NCL_overlay_11b.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Gallery/Overlays/NCL_overlay_11b.py b/Gallery/Overlays/NCL_overlay_11b.py index a9848737d..6c0fef6b1 100644 --- a/Gallery/Overlays/NCL_overlay_11b.py +++ b/Gallery/Overlays/NCL_overlay_11b.py @@ -175,15 +175,7 @@ # another contour plot and clip that contour plot with the patch. In # other words, every island on this plot corresponds to its own # contour plot!) - cf = ax.contourf(lon, lat, T, levels=clevs, cmap=newcmp) - - # Clip each contour of the contour plot - # (NOTE: Each contour of the contour plot is actually its own "plot". There - # is no easy mechanism in matplotlib to clip the entire contour plot - # at once, so we must loop through the "collections" in the contour - # plot and clip each one separately.) - for col in cf.collections: - col.set_clip_path(patch) + cf = ax.contourf(lon, lat, T, levels=clevs, cmap=newcmp, clip_path=patch) # Add horizontal colorbar cax = plt.axes((0.14, 0.08, 0.74, 0.02)) From ed07b3341e1473be6a5cd1bffc3c430c41ea9268 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:12:29 -0600 Subject: [PATCH 3/3] Update NCL_hov_3.py to address matplotlib 3.10 deprecations --- Gallery/Contours/NCL_hov_3.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Gallery/Contours/NCL_hov_3.py b/Gallery/Contours/NCL_hov_3.py index 1512c9d82..0151a8f6e 100644 --- a/Gallery/Contours/NCL_hov_3.py +++ b/Gallery/Contours/NCL_hov_3.py @@ -49,9 +49,8 @@ hatches=['....']) # Make all dot-filled areas light gray so contour lines are still visible -for i, collection in enumerate(cf.collections): - collection.set_edgecolor('lightgray') - collection.set_linewidth(0.) +cf.set_edgecolor('lightgray') +cf.set_linewidth(0.) # Fill area at the lowest contour level, -6, with line hatching cf = ax.contourf(lon,