From f37099c4e0fd1338ac82223e8a4f513279553260 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Fri, 7 Feb 2025 11:12:35 +0100 Subject: [PATCH 1/2] DOC: Minor example cleanup - do not assign the patch to a separate variable - one typically would not do this. - Correct references --- .../ticks/fig_axes_customize_simple.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/galleries/examples/ticks/fig_axes_customize_simple.py b/galleries/examples/ticks/fig_axes_customize_simple.py index 510ec8e77b6a..a06b905c4dac 100644 --- a/galleries/examples/ticks/fig_axes_customize_simple.py +++ b/galleries/examples/ticks/fig_axes_customize_simple.py @@ -10,16 +10,11 @@ import matplotlib.pyplot as plt -# %% -# `.pyplot.figure` creates a `matplotlib.figure.Figure` instance. - fig = plt.figure() -rect = fig.patch # a rectangle instance -rect.set_facecolor('lightgoldenrodyellow') +rect = fig.patch.set_facecolor('lightgoldenrodyellow') ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4]) -rect = ax1.patch -rect.set_facecolor('lightslategray') +ax1.patch.set_facecolor('lightslategray') ax1.tick_params(axis='x', labelcolor='tab:red', labelrotation=45, labelsize=16) ax1.tick_params(axis='y', color='tab:green', size=25, width=3) @@ -33,13 +28,5 @@ # The use of the following functions, methods, classes and modules is shown # in this example: # -# - `matplotlib.axis.Axis.get_ticklabels` -# - `matplotlib.axis.Axis.get_ticklines` -# - `matplotlib.text.Text.set_rotation` -# - `matplotlib.text.Text.set_fontsize` -# - `matplotlib.text.Text.set_color` -# - `matplotlib.lines.Line2D` -# - `matplotlib.lines.Line2D.set_markeredgecolor` -# - `matplotlib.lines.Line2D.set_markersize` -# - `matplotlib.lines.Line2D.set_markeredgewidth` +# - `matplotlib.axes.Axes.tick_params` # - `matplotlib.patches.Patch.set_facecolor` From 0f4421c499e888e832eeb401103f1d159b97aded Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Fri, 7 Feb 2025 12:20:01 +0100 Subject: [PATCH 2/2] Update galleries/examples/ticks/fig_axes_customize_simple.py Co-authored-by: Oscar Gustafsson --- galleries/examples/ticks/fig_axes_customize_simple.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/examples/ticks/fig_axes_customize_simple.py b/galleries/examples/ticks/fig_axes_customize_simple.py index a06b905c4dac..0dd85ec4bd93 100644 --- a/galleries/examples/ticks/fig_axes_customize_simple.py +++ b/galleries/examples/ticks/fig_axes_customize_simple.py @@ -11,7 +11,7 @@ import matplotlib.pyplot as plt fig = plt.figure() -rect = fig.patch.set_facecolor('lightgoldenrodyellow') +fig.patch.set_facecolor('lightgoldenrodyellow') ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4]) ax1.patch.set_facecolor('lightslategray')