From f1870f265ce5dc642fd0335ffc5920d7334f2323 Mon Sep 17 00:00:00 2001 From: Steffen Rehberg Date: Sun, 11 Sep 2022 13:05:16 +0200 Subject: [PATCH] DOC: fix deprecations in examples - The dist attribute was deprecated in Matplotlib 3.6 and will be removed two minor releases later. - Passing the loc parameter of __init__() positionally is deprecated since Matplotlib 3.6; the parameter will become keyword-only two minor releases later. - Passing the radius parameter of __init__() positionally is deprecated since Matplotlib 3.6; the parameter will become keyword-only two minor releases later. - Passing the closed parameter of __init__() positionally is deprecated since Matplotlib 3.6; the parameter will become keyword-only two minor releases later. - Auto-removal of grids by pcolor() and pcolormesh() is deprecated since 3.5 and will be removed two minor releases later; please call grid(False) first. --- examples/mplot3d/box3d.py | 4 ++-- examples/shapes_and_collections/artist_reference.py | 2 +- examples/shapes_and_collections/patch_collection.py | 2 +- examples/specialty_plots/leftventricle_bulleye.py | 3 +++ examples/text_labels_and_annotations/figlegend_demo.py | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/mplot3d/box3d.py b/examples/mplot3d/box3d.py index f5642e229110..bbe4accec183 100644 --- a/examples/mplot3d/box3d.py +++ b/examples/mplot3d/box3d.py @@ -67,9 +67,9 @@ zticks=[0, -150, -300, -450], ) -# Set distance and angle view +# Set zoom and angle view ax.view_init(40, -30, 0) -ax.dist = 11 +ax.set_box_aspect(None, zoom=0.9) # Colorbar fig.colorbar(C, ax=ax, fraction=0.02, pad=0.1, label='Name [units]') diff --git a/examples/shapes_and_collections/artist_reference.py b/examples/shapes_and_collections/artist_reference.py index 5bda4cd217ca..054c1f1e088a 100644 --- a/examples/shapes_and_collections/artist_reference.py +++ b/examples/shapes_and_collections/artist_reference.py @@ -45,7 +45,7 @@ def label(xy, text): label(grid[2], "Wedge") # add a Polygon -polygon = mpatches.RegularPolygon(grid[3], 5, 0.1) +polygon = mpatches.RegularPolygon(grid[3], 5, radius=0.1) patches.append(polygon) label(grid[3], "Polygon") diff --git a/examples/shapes_and_collections/patch_collection.py b/examples/shapes_and_collections/patch_collection.py index b980694627f9..cdd9f4687619 100644 --- a/examples/shapes_and_collections/patch_collection.py +++ b/examples/shapes_and_collections/patch_collection.py @@ -45,7 +45,7 @@ ] for i in range(N): - polygon = Polygon(np.random.rand(N, 2), True) + polygon = Polygon(np.random.rand(N, 2), closed=True) patches.append(polygon) colors = 100 * np.random.rand(len(patches)) diff --git a/examples/specialty_plots/leftventricle_bulleye.py b/examples/specialty_plots/leftventricle_bulleye.py index c687aa00decd..b3e1ecbfd25c 100644 --- a/examples/specialty_plots/leftventricle_bulleye.py +++ b/examples/specialty_plots/leftventricle_bulleye.py @@ -56,6 +56,9 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None): theta = np.linspace(0, 2 * np.pi, 768) r = np.linspace(0.2, 1, 4) + # Remove grid + ax.grid(False) + # Create the bound for the segment 17 for i in range(r.shape[0]): ax.plot(theta, np.repeat(r[i], theta.shape), '-k', lw=linewidth) diff --git a/examples/text_labels_and_annotations/figlegend_demo.py b/examples/text_labels_and_annotations/figlegend_demo.py index 674b7627f09f..6fc31235f634 100644 --- a/examples/text_labels_and_annotations/figlegend_demo.py +++ b/examples/text_labels_and_annotations/figlegend_demo.py @@ -23,8 +23,8 @@ l3, = axs[1].plot(x, y3, color='tab:green') l4, = axs[1].plot(x, y4, color='tab:red', marker='^') -fig.legend((l1, l2), ('Line 1', 'Line 2'), 'upper left') -fig.legend((l3, l4), ('Line 3', 'Line 4'), 'upper right') +fig.legend((l1, l2), ('Line 1', 'Line 2'), loc='upper left') +fig.legend((l3, l4), ('Line 3', 'Line 4'), loc='upper right') plt.tight_layout() plt.show()