From a57683ebbe9076e776a21a0013df2f8cfe52c094 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:21:38 +0200 Subject: [PATCH] Use Axes instead of axes in galleries Part of #18726. --- galleries/examples/animation/multiple_axes.py | 2 +- galleries/examples/animation/random_walk.py | 2 +- .../examples/axes_grid1/demo_axes_divider.py | 10 ++-- .../examples/axes_grid1/demo_axes_grid.py | 12 ++--- .../examples/axes_grid1/demo_axes_grid2.py | 4 +- .../axes_grid1/demo_axes_hbox_divider.py | 4 +- .../axes_grid1/demo_colorbar_of_inset_axes.py | 2 +- .../demo_colorbar_with_axes_divider.py | 12 ++--- .../demo_colorbar_with_inset_locator.py | 2 +- .../examples/axes_grid1/demo_edge_colorbar.py | 4 +- .../axes_grid1/demo_fixed_size_axes.py | 4 +- .../examples/axes_grid1/inset_locator_demo.py | 22 ++++----- .../axes_grid1/inset_locator_demo2.py | 8 ++-- .../axes_grid1/scatter_hist_locatable_axes.py | 10 ++-- .../axes_grid1/simple_axes_divider1.py | 6 +-- .../axes_grid1/simple_axes_divider3.py | 2 +- .../examples/axes_grid1/simple_axesgrid.py | 4 +- .../axisartist/demo_axisline_style.py | 2 +- .../axisartist/demo_curvelinear_grid.py | 2 +- .../axisartist/demo_curvelinear_grid2.py | 2 +- .../examples/axisartist/demo_floating_axes.py | 4 +- .../examples/axisartist/demo_parasite_axes.py | 2 +- .../examples/axisartist/simple_axisartist1.py | 2 +- galleries/examples/color/colorbar_basics.py | 4 +- .../examples/event_handling/data_browser.py | 2 +- .../examples/event_handling/pong_sgskip.py | 2 +- .../image_annotated_heatmap.py | 2 +- .../categorical_variables.py | 2 +- .../eventcollection_demo.py | 2 +- .../fill_between_demo.py | 4 +- .../lines_bars_and_markers/filled_step.py | 4 +- .../lines_bars_and_markers/gradient_bar.py | 2 +- .../lines_bars_and_markers/scatter_hist.py | 32 ++++++------- .../vline_hline_demo.py | 2 +- galleries/examples/misc/coords_report.py | 2 +- galleries/examples/misc/custom_projection.py | 14 +++--- galleries/examples/misc/fig_x.py | 2 +- galleries/examples/misc/logos2.py | 2 +- galleries/examples/misc/rasterization_demo.py | 2 +- galleries/examples/misc/svg_filter_pie.py | 2 +- galleries/examples/misc/table_demo.py | 2 +- galleries/examples/misc/transoffset.py | 2 +- galleries/examples/misc/zorder_demo.py | 2 +- galleries/examples/mplot3d/3d_bars.py | 2 +- galleries/examples/mplot3d/mixed_subplots.py | 2 +- galleries/examples/mplot3d/pathpatch3d.py | 2 +- galleries/examples/mplot3d/subplot3d.py | 4 +- .../pie_and_polar_charts/bar_of_pie.py | 2 +- .../pie_and_polar_charts/nested_pie.py | 2 +- .../pie_and_polar_charts/polar_legend.py | 6 +-- galleries/examples/pyplots/pyplot_text.py | 2 +- .../shapes_and_collections/arrow_guide.py | 2 +- .../shapes_and_collections/fancybox_demo.py | 2 +- .../patch_collection.py | 2 +- .../specialty_plots/leftventricle_bullseye.py | 4 +- .../examples/specialty_plots/radar_chart.py | 8 ++-- .../spines/centered_spines_with_arrows.py | 2 +- .../spines/multiple_yaxis_with_spines.py | 4 +- galleries/examples/spines/spines.py | 2 +- galleries/examples/spines/spines_dropped.py | 2 +- galleries/examples/statistics/boxplot.py | 2 +- .../examples/statistics/confidence_ellipse.py | 4 +- .../statistics/errorbars_and_boxes.py | 4 +- .../axes_box_aspect.py | 22 ++++----- .../subplots_axes_and_figures/axes_demo.py | 6 +-- .../subplots_axes_and_figures/axes_margins.py | 2 +- .../axes_zoom_effect.py | 12 ++--- .../subplots_axes_and_figures/axhspan_demo.py | 10 ++-- .../subplots_axes_and_figures/broken_axis.py | 8 ++-- .../demo_constrained_layout.py | 8 ++-- .../demo_tight_layout.py | 4 +- .../fahrenheit_celsius_scales.py | 2 +- .../subplots_axes_and_figures/figure_title.py | 2 +- .../subplots_axes_and_figures/ganged_plots.py | 2 +- .../gridspec_and_subplots.py | 12 ++--- .../multiple_figs_demo.py | 2 +- .../share_axis_lims_views.py | 2 +- .../shared_axis_demo.py | 2 +- .../subplots_axes_and_figures/subfigures.py | 2 +- .../subplots_demo.py | 4 +- .../subplots_axes_and_figures/two_scales.py | 12 ++--- .../zoom_inset_axes.py | 6 +-- .../align_ylabels.py | 2 +- .../annotation_demo.py | 20 ++++---- .../text_labels_and_annotations/arrow_demo.py | 2 +- .../demo_text_rotation_mode.py | 6 +-- .../figlegend_demo.py | 2 +- .../label_subplots.py | 4 +- .../line_with_text.py | 2 +- .../placing_text_boxes.py | 2 +- .../titles_demo.py | 2 +- .../ticks/colorbar_tick_labelling_demo.py | 4 +- .../examples/ticks/ticklabels_rotation.py | 2 +- .../embedding_in_wx4_sgskip.py | 2 +- .../user_interfaces/fourier_demo_wx_sgskip.py | 2 +- galleries/examples/widgets/multicursor.py | 4 +- galleries/tutorials/artists.py | 8 ++-- galleries/tutorials/lifecycle.py | 6 +-- galleries/tutorials/pyplot.py | 20 ++++---- .../users_explain/artists/color_cycle.py | 6 +-- .../users_explain/artists/imshow_extent.py | 8 ++-- galleries/users_explain/artists/paths.py | 2 +- .../artists/transforms_tutorial.py | 30 ++++++------ .../users_explain/axes/arranging_axes.py | 6 +-- galleries/users_explain/axes/autoscale.py | 6 +-- galleries/users_explain/axes/axes_ticks.py | 2 +- .../users_explain/axes/colorbar_placement.py | 46 +++++++++---------- galleries/users_explain/axes/legend_guide.py | 4 +- galleries/users_explain/axes/mosaic.py | 10 ++-- .../users_explain/axes/tight_layout_guide.py | 16 +++---- .../users_explain/colors/colorbar_only.py | 2 +- galleries/users_explain/customizing.py | 2 +- galleries/users_explain/quick_start.py | 18 ++++---- galleries/users_explain/text/annotations.py | 26 +++++------ galleries/users_explain/text/text_props.py | 4 +- lib/matplotlib/figure.py | 12 ++--- 116 files changed, 341 insertions(+), 341 deletions(-) diff --git a/galleries/examples/animation/multiple_axes.py b/galleries/examples/animation/multiple_axes.py index 2c3442c36d63..9f1c31429520 100644 --- a/galleries/examples/animation/multiple_axes.py +++ b/galleries/examples/animation/multiple_axes.py @@ -1,6 +1,6 @@ """ ======================= -Multiple axes animation +Multiple Axes animation ======================= This example showcases: diff --git a/galleries/examples/animation/random_walk.py b/galleries/examples/animation/random_walk.py index d108da5633b5..10dcf5ade164 100644 --- a/galleries/examples/animation/random_walk.py +++ b/galleries/examples/animation/random_walk.py @@ -42,7 +42,7 @@ def update_lines(num, walks, lines): # Create lines initially without data lines = [ax.plot([], [], [])[0] for _ in walks] -# Setting the axes properties +# Setting the Axes properties ax.set(xlim3d=(0, 1), xlabel='X') ax.set(ylim3d=(0, 1), ylabel='Y') ax.set(zlim3d=(0, 1), zlabel='Z') diff --git a/galleries/examples/axes_grid1/demo_axes_divider.py b/galleries/examples/axes_grid1/demo_axes_divider.py index ed2e163154c4..42be8aacd8be 100644 --- a/galleries/examples/axes_grid1/demo_axes_divider.py +++ b/galleries/examples/axes_grid1/demo_axes_divider.py @@ -3,8 +3,8 @@ Axes divider ============ -Axes divider to calculate location of axes and -create a divider for them using existing axes instances. +Axes divider to calculate location of Axes and +create a divider for them using existing Axes instances. """ import matplotlib.pyplot as plt @@ -30,13 +30,13 @@ def demo_locatable_axes_hard(fig): divider = SubplotDivider(fig, 2, 2, 2, aspect=True) - # axes for image + # Axes for image ax = fig.add_subplot(axes_locator=divider.new_locator(nx=0, ny=0)) - # axes for colorbar + # Axes for colorbar ax_cb = fig.add_subplot(axes_locator=divider.new_locator(nx=2, ny=0)) divider.set_horizontal([ - Size.AxesX(ax), # main axes + Size.AxesX(ax), # main Axes Size.Fixed(0.05), # padding, 0.1 inch Size.Fixed(0.2), # colorbar, 0.3 inch ]) diff --git a/galleries/examples/axes_grid1/demo_axes_grid.py b/galleries/examples/axes_grid1/demo_axes_grid.py index 70bb19da38fa..d29ca6a05859 100644 --- a/galleries/examples/axes_grid1/demo_axes_grid.py +++ b/galleries/examples/axes_grid1/demo_axes_grid.py @@ -3,7 +3,7 @@ Demo Axes Grid ============== -Grid of 2x2 images with a single colorbar or with one colorbar per axes. +Grid of 2x2 images with a single colorbar or with one colorbar per Axes. """ import matplotlib.pyplot as plt @@ -17,13 +17,13 @@ # A grid of 2x2 images with 0.05 inch pad between images and only the -# lower-left axes is labeled. +# lower-left Axes is labeled. grid = ImageGrid( fig, 141, # similar to fig.add_subplot(141). nrows_ncols=(2, 2), axes_pad=0.05, label_mode="1") for ax in grid: ax.imshow(Z, extent=extent) -# This only affects axes in first column and second row as share_all=False. +# This only affects Axes in first column and second row as share_all=False. grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2]) @@ -37,7 +37,7 @@ grid.cbar_axes[0].colorbar(im) for cax in grid.cbar_axes: cax.tick_params(labeltop=False) -# This affects all axes as share_all = True. +# This affects all Axes as share_all = True. grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2]) @@ -50,7 +50,7 @@ im = ax.imshow(Z, extent=extent) cax.colorbar(im) cax.tick_params(labeltop=False) -# This affects all axes as share_all = True. +# This affects all Axes as share_all = True. grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2]) @@ -65,7 +65,7 @@ im = ax.imshow(Z, extent=extent, vmin=vlim[0], vmax=vlim[1]) cb = cax.colorbar(im) cb.set_ticks((vlim[0], vlim[1])) -# This affects all axes as share_all = True. +# This affects all Axes as share_all = True. grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2]) diff --git a/galleries/examples/axes_grid1/demo_axes_grid2.py b/galleries/examples/axes_grid1/demo_axes_grid2.py index 98eeb15ead51..458e83b6d68f 100644 --- a/galleries/examples/axes_grid1/demo_axes_grid2.py +++ b/galleries/examples/axes_grid1/demo_axes_grid2.py @@ -33,7 +33,7 @@ def add_inner_title(ax, title, loc, **kwargs): ZS = [Z[i::3, :] for i in range(3)] extent = extent[0], extent[1]/3., extent[2], extent[3] -# *** Demo 1: colorbar at each axes *** +# *** Demo 1: colorbar at each Axes *** grid = ImageGrid( # 211 = at the position of fig.add_subplot(211) fig, 211, nrows_ncols=(1, 3), axes_pad=0.05, label_mode="1", share_all=True, @@ -60,7 +60,7 @@ def add_inner_title(ax, title, loc, **kwargs): for ax, z in zip(grid2, ZS): im = ax.imshow(z, clim=clim, origin="lower", extent=extent) -# With cbar_mode="single", cax attribute of all axes are identical. +# With cbar_mode="single", cax attribute of all Axes are identical. ax.cax.colorbar(im) for ax, im_title in zip(grid2, ["(a)", "(b)", "(c)"]): diff --git a/galleries/examples/axes_grid1/demo_axes_hbox_divider.py b/galleries/examples/axes_grid1/demo_axes_hbox_divider.py index 65d6764a3374..5188bdf66d6f 100644 --- a/galleries/examples/axes_grid1/demo_axes_hbox_divider.py +++ b/galleries/examples/axes_grid1/demo_axes_hbox_divider.py @@ -5,7 +5,7 @@ Using an `.HBoxDivider` to arrange subplots. -Note that both axes' location are adjusted so that they have +Note that both Axes' location are adjusted so that they have equal heights while maintaining their aspect ratios. """ @@ -36,7 +36,7 @@ # %% # Using a `.VBoxDivider` to arrange subplots. # -# Note that both axes' location are adjusted so that they have +# Note that both Axes' location are adjusted so that they have # equal widths while maintaining their aspect ratios. fig, (ax1, ax2) = plt.subplots(2, 1) diff --git a/galleries/examples/axes_grid1/demo_colorbar_of_inset_axes.py b/galleries/examples/axes_grid1/demo_colorbar_of_inset_axes.py index 341e11ff52b5..242beec26266 100644 --- a/galleries/examples/axes_grid1/demo_colorbar_of_inset_axes.py +++ b/galleries/examples/axes_grid1/demo_colorbar_of_inset_axes.py @@ -1,6 +1,6 @@ """ =============================== -Adding a colorbar to inset axes +Adding a colorbar to inset Axes =============================== """ diff --git a/galleries/examples/axes_grid1/demo_colorbar_with_axes_divider.py b/galleries/examples/axes_grid1/demo_colorbar_with_axes_divider.py index 9e4611c65bb7..1a1eb1d8c48d 100644 --- a/galleries/examples/axes_grid1/demo_colorbar_with_axes_divider.py +++ b/galleries/examples/axes_grid1/demo_colorbar_with_axes_divider.py @@ -5,14 +5,14 @@ Colorbar with AxesDivider ========================= -The `.axes_divider.make_axes_locatable` function takes an existing axes, adds +The `.axes_divider.make_axes_locatable` function takes an existing Axes, adds it to a new `.AxesDivider` and returns the `.AxesDivider`. The `.append_axes` -method of the `.AxesDivider` can then be used to create a new axes on a given -side ("top", "right", "bottom", or "left") of the original axes. This example -uses `.append_axes` to add colorbars next to axes. +method of the `.AxesDivider` can then be used to create a new Axes on a given +side ("top", "right", "bottom", or "left") of the original Axes. This example +uses `.append_axes` to add colorbars next to Axes. -Users should consider simply passing the main axes to the *ax* keyword argument of -`~.Figure.colorbar` instead of creating a locatable axes manually like this. +Users should consider simply passing the main Axes to the *ax* keyword argument of +`~.Figure.colorbar` instead of creating a locatable Axes manually like this. See :ref:`colorbar_placement`. """ diff --git a/galleries/examples/axes_grid1/demo_colorbar_with_inset_locator.py b/galleries/examples/axes_grid1/demo_colorbar_with_inset_locator.py index 8ec7d0e7271b..879ec0485967 100644 --- a/galleries/examples/axes_grid1/demo_colorbar_with_inset_locator.py +++ b/galleries/examples/axes_grid1/demo_colorbar_with_inset_locator.py @@ -8,7 +8,7 @@ This example shows how to control the position, height, and width of colorbars using `~mpl_toolkits.axes_grid1.inset_locator.inset_axes`. -Inset axes placement is controlled as for legends: either by providing a *loc* +Inset Axes placement is controlled as for legends: either by providing a *loc* option ("upper right", "best", ...), or by providing a locator with respect to the parent bbox. Parameters such as *bbox_to_anchor* and *borderpad* likewise work in the same way, and are also demonstrated here. diff --git a/galleries/examples/axes_grid1/demo_edge_colorbar.py b/galleries/examples/axes_grid1/demo_edge_colorbar.py index e0d5f2b45f77..bde482977991 100644 --- a/galleries/examples/axes_grid1/demo_edge_colorbar.py +++ b/galleries/examples/axes_grid1/demo_edge_colorbar.py @@ -44,7 +44,7 @@ def demo_bottom_cbar(fig): for cax in grid.cbar_axes: cax.axis[cax.orientation].set_label("Bar") - # This affects all axes as share_all = True. + # This affects all Axes as share_all = True. grid.axes_llc.set_xticks([-2, 0, 2]) grid.axes_llc.set_yticks([-2, 0, 2]) @@ -73,7 +73,7 @@ def demo_right_cbar(fig): for cax in grid.cbar_axes: cax.axis[cax.orientation].set_label('Foo') - # This affects all axes because we set share_all = True. + # This affects all Axes because we set share_all = True. grid.axes_llc.set_xticks([-2, 0, 2]) grid.axes_llc.set_yticks([-2, 0, 2]) diff --git a/galleries/examples/axes_grid1/demo_fixed_size_axes.py b/galleries/examples/axes_grid1/demo_fixed_size_axes.py index 7f56c97ee126..a8f8685a115c 100644 --- a/galleries/examples/axes_grid1/demo_fixed_size_axes.py +++ b/galleries/examples/axes_grid1/demo_fixed_size_axes.py @@ -16,7 +16,7 @@ fig = plt.figure(figsize=(6, 6)) -# The first items are for padding and the second items are for the axes. +# The first items are for padding and the second items are for the Axes. # sizes are in inch. h = [Size.Fixed(1.0), Size.Fixed(4.5)] v = [Size.Fixed(0.7), Size.Fixed(5.)] @@ -35,7 +35,7 @@ fig = plt.figure(figsize=(6, 6)) # The first & third items are for padding and the second items are for the -# axes. Sizes are in inches. +# Axes. Sizes are in inches. h = [Size.Fixed(1.0), Size.Scaled(1.), Size.Fixed(.2)] v = [Size.Fixed(0.7), Size.Scaled(1.), Size.Fixed(.5)] diff --git a/galleries/examples/axes_grid1/inset_locator_demo.py b/galleries/examples/axes_grid1/inset_locator_demo.py index b0af820a4253..fa9c4593d932 100644 --- a/galleries/examples/axes_grid1/inset_locator_demo.py +++ b/galleries/examples/axes_grid1/inset_locator_demo.py @@ -7,7 +7,7 @@ # %% # The `.inset_locator`'s `~.inset_locator.inset_axes` allows -# easily placing insets in the corners of the axes by specifying a width and +# easily placing insets in the corners of the Axes by specifying a width and # height and optionally a location (loc) that accepts locations as codes, # similar to `~matplotlib.axes.Axes.legend`. # By default, the inset is offset by some points from the axes, @@ -23,17 +23,17 @@ # at the default upper right location axins = inset_axes(ax, width=1.3, height=0.9) -# Create inset of width 30% and height 40% of the parent axes' bounding box +# Create inset of width 30% and height 40% of the parent Axes' bounding box # at the lower left corner (loc=3) axins2 = inset_axes(ax, width="30%", height="40%", loc=3) # Create inset of mixed specifications in the second subplot; -# width is 30% of parent axes' bounding box and +# width is 30% of parent Axes' bounding box and # height is 1 inch at the upper left corner (loc=2) axins3 = inset_axes(ax2, width="30%", height=1., loc=2) # Create an inset in the lower right corner (loc=4) with borderpad=1, i.e. -# 10 points padding (as 10pt is the default fontsize) to the parent axes +# 10 points padding (as 10pt is the default fontsize) to the parent Axes axins4 = inset_axes(ax2, width="20%", height="20%", loc=4, borderpad=1) # Turn ticklabels of insets off @@ -54,9 +54,9 @@ fig = plt.figure(figsize=[5.5, 2.8]) ax = fig.add_subplot(121) -# We use the axes transform as bbox_transform. Therefore, the bounding box +# We use the Axes transform as bbox_transform. Therefore, the bounding box # needs to be specified in axes coordinates ((0, 0) is the lower left corner -# of the axes, (1, 1) is the upper right corner). +# of the Axes, (1, 1) is the upper right corner). # The bounding box (.2, .4, .6, .5) starts at (.2, .4) and ranges to (.8, .9) # in those coordinates. # Inside this bounding box an inset of half the bounding box' width and @@ -78,7 +78,7 @@ # Note how the two following insets are created at the same positions, one by -# use of the default parent axes' bbox and the other via a bbox in axes +# use of the default parent Axes' bbox and the other via a bbox in Axes # coordinates and the respective transform. ax2 = fig.add_subplot(222) axins2 = inset_axes(ax2, width="30%", height="50%") @@ -101,8 +101,8 @@ # %% -# In the above the axes transform together with 4-tuple bounding boxes has been -# used as it mostly is useful to specify an inset relative to the axes it is +# In the above the Axes transform together with 4-tuple bounding boxes has been +# used as it mostly is useful to specify an inset relative to the Axes it is # an inset to. However, other use cases are equally possible. The following # example examines some of those. # @@ -110,7 +110,7 @@ fig = plt.figure(figsize=[5.5, 2.8]) ax = fig.add_subplot(131) -# Create an inset outside the axes +# Create an inset outside the Axes axins = inset_axes(ax, width="100%", height="100%", bbox_to_anchor=(1.05, .6, .5, .4), bbox_transform=ax.transAxes, loc=2, borderpad=0) @@ -134,7 +134,7 @@ bbox_transform=ax2.transData, loc=2, borderpad=0) # Create an inset horizontally centered in figure coordinates and vertically -# bound to line up with the axes. +# bound to line up with the Axes. from matplotlib.transforms import blended_transform_factory # noqa transform = blended_transform_factory(fig.transFigure, ax2.transAxes) diff --git a/galleries/examples/axes_grid1/inset_locator_demo2.py b/galleries/examples/axes_grid1/inset_locator_demo2.py index 38a58a7df2ff..f648c38e8d55 100644 --- a/galleries/examples/axes_grid1/inset_locator_demo2.py +++ b/galleries/examples/axes_grid1/inset_locator_demo2.py @@ -26,7 +26,7 @@ ax.set_aspect(1) axins = zoomed_inset_axes(ax, zoom=0.5, loc='upper right') -# fix the number of ticks on the inset axes +# fix the number of ticks on the inset Axes axins.yaxis.get_major_locator().set_params(nbins=7) axins.xaxis.get_major_locator().set_params(nbins=7) axins.tick_params(labelleft=False, labelbottom=False) @@ -61,13 +61,13 @@ def add_sizebar(ax, size): x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9 axins2.set_xlim(x1, x2) axins2.set_ylim(y1, y2) -# fix the number of ticks on the inset axes +# fix the number of ticks on the inset Axes axins2.yaxis.get_major_locator().set_params(nbins=7) axins2.xaxis.get_major_locator().set_params(nbins=7) axins2.tick_params(labelleft=False, labelbottom=False) -# draw a bbox of the region of the inset axes in the parent axes and -# connecting lines between the bbox and the inset axes area +# draw a bbox of the region of the inset Axes in the parent Axes and +# connecting lines between the bbox and the inset Axes area mark_inset(ax2, axins2, loc1=2, loc2=4, fc="none", ec="0.5") plt.show() diff --git a/galleries/examples/axes_grid1/scatter_hist_locatable_axes.py b/galleries/examples/axes_grid1/scatter_hist_locatable_axes.py index 8304334b90eb..e5ff19d9ee08 100644 --- a/galleries/examples/axes_grid1/scatter_hist_locatable_axes.py +++ b/galleries/examples/axes_grid1/scatter_hist_locatable_axes.py @@ -6,12 +6,12 @@ Show the marginal distributions of a scatter plot as histograms at the sides of the plot. -For a nice alignment of the main axes with the marginals, the axes positions +For a nice alignment of the main Axes with the marginals, the Axes positions are defined by a ``Divider``, produced via `.make_axes_locatable`. Note that -the ``Divider`` API allows setting axes sizes and pads in inches, which is its +the ``Divider`` API allows setting Axes sizes and pads in inches, which is its main feature. -If one wants to set axes sizes and pads relative to the main Figure, see the +If one wants to set Axes sizes and pads relative to the main Figure, see the :doc:`/gallery/lines_bars_and_markers/scatter_hist` example. """ @@ -33,10 +33,10 @@ # the scatter plot: ax.scatter(x, y) -# Set aspect of the main axes. +# Set aspect of the main Axes. ax.set_aspect(1.) -# create new axes on the right and on the top of the current axes +# create new Axes on the right and on the top of the current Axes divider = make_axes_locatable(ax) # below height and pad are in inches ax_histx = divider.append_axes("top", 1.2, pad=0.1, sharex=ax) diff --git a/galleries/examples/axes_grid1/simple_axes_divider1.py b/galleries/examples/axes_grid1/simple_axes_divider1.py index 4b7edc27ae9b..414672dc3596 100644 --- a/galleries/examples/axes_grid1/simple_axes_divider1.py +++ b/galleries/examples/axes_grid1/simple_axes_divider1.py @@ -20,7 +20,7 @@ def label_axes(ax, text): # %% -# Fixed axes sizes; fixed paddings. +# Fixed Axes sizes; fixed paddings. fig = plt.figure(figsize=(6, 6)) fig.suptitle("Fixed axes sizes, fixed paddings") @@ -30,7 +30,7 @@ def label_axes(ax, text): vert = [Size.Fixed(1.5), Size.Fixed(.5), Size.Fixed(1.)] rect = (0.1, 0.1, 0.8, 0.8) -# Divide the axes rectangle into a grid with sizes specified by horiz * vert. +# Divide the Axes rectangle into a grid with sizes specified by horiz * vert. div = Divider(fig, rect, horiz, vert, aspect=False) # The rect parameter will actually be ignored and overridden by axes_locator. @@ -53,7 +53,7 @@ def label_axes(ax, text): vert = [Size.Scaled(1.), Size.Fixed(.5), Size.Scaled(1.5)] rect = (0.1, 0.1, 0.8, 0.8) -# Divide the axes rectangle into a grid with sizes specified by horiz * vert. +# Divide the Axes rectangle into a grid with sizes specified by horiz * vert. div = Divider(fig, rect, horiz, vert, aspect=False) # The rect parameter will actually be ignored and overridden by axes_locator. diff --git a/galleries/examples/axes_grid1/simple_axes_divider3.py b/galleries/examples/axes_grid1/simple_axes_divider3.py index 54050633d4ea..e2f195bcb753 100644 --- a/galleries/examples/axes_grid1/simple_axes_divider3.py +++ b/galleries/examples/axes_grid1/simple_axes_divider3.py @@ -21,7 +21,7 @@ horiz = [Size.AxesX(ax[0]), Size.Fixed(.5), Size.AxesX(ax[1])] vert = [Size.AxesY(ax[0]), Size.Fixed(.5), Size.AxesY(ax[2])] -# divide the axes rectangle into grid whose size is specified by horiz * vert +# divide the Axes rectangle into grid whose size is specified by horiz * vert divider = Divider(fig, rect, horiz, vert, aspect=False) diff --git a/galleries/examples/axes_grid1/simple_axesgrid.py b/galleries/examples/axes_grid1/simple_axesgrid.py index ef13fdd74aee..bc9ffce692f8 100644 --- a/galleries/examples/axes_grid1/simple_axesgrid.py +++ b/galleries/examples/axes_grid1/simple_axesgrid.py @@ -18,8 +18,8 @@ fig = plt.figure(figsize=(4., 4.)) grid = ImageGrid(fig, 111, # similar to subplot(111) - nrows_ncols=(2, 2), # creates 2x2 grid of axes - axes_pad=0.1, # pad between axes in inch. + nrows_ncols=(2, 2), # creates 2x2 grid of Axes + axes_pad=0.1, # pad between Axes in inch. ) for ax, im in zip(grid, [im1, im2, im3, im4]): diff --git a/galleries/examples/axisartist/demo_axisline_style.py b/galleries/examples/axisartist/demo_axisline_style.py index 644864be8103..3fd1d4d8b767 100644 --- a/galleries/examples/axisartist/demo_axisline_style.py +++ b/galleries/examples/axisartist/demo_axisline_style.py @@ -5,7 +5,7 @@ This example shows some configurations for axis style. -Note: The `mpl_toolkits.axisartist` axes classes may be confusing for new +Note: The `mpl_toolkits.axisartist` Axes classes may be confusing for new users. If the only aim is to obtain arrow heads at the ends of the axes, rather check out the :doc:`/gallery/spines/centered_spines_with_arrows` example. diff --git a/galleries/examples/axisartist/demo_curvelinear_grid.py b/galleries/examples/axisartist/demo_curvelinear_grid.py index 76ade00ecb5e..fb1fbdd011ce 100644 --- a/galleries/examples/axisartist/demo_curvelinear_grid.py +++ b/galleries/examples/axisartist/demo_curvelinear_grid.py @@ -90,7 +90,7 @@ def curvelinear_test2(fig): ax1.grid(True, zorder=0) - # A parasite axes with given transform + # A parasite Axes with given transform ax2 = ax1.get_aux_axes(tr) # note that ax2.transData == tr + ax1.transData # Anything you draw in ax2 will match the ticks and grids of ax1. diff --git a/galleries/examples/axisartist/demo_curvelinear_grid2.py b/galleries/examples/axisartist/demo_curvelinear_grid2.py index 4a8c115f196f..9bf3c5598244 100644 --- a/galleries/examples/axisartist/demo_curvelinear_grid2.py +++ b/galleries/examples/axisartist/demo_curvelinear_grid2.py @@ -7,7 +7,7 @@ This example demonstrates how to use GridHelperCurveLinear to define custom grids and ticklines by applying a transformation on the grid. -As showcase on the plot, a 5x5 matrix is displayed on the axes. +As showcase on the plot, a 5x5 matrix is displayed on the Axes. """ import matplotlib.pyplot as plt diff --git a/galleries/examples/axisartist/demo_floating_axes.py b/galleries/examples/axisartist/demo_floating_axes.py index 87577b29c756..add03e266d3e 100644 --- a/galleries/examples/axisartist/demo_floating_axes.py +++ b/galleries/examples/axisartist/demo_floating_axes.py @@ -76,7 +76,7 @@ def setup_axes2(fig, rect): rect, axes_class=floating_axes.FloatingAxes, grid_helper=grid_helper) ax1.grid() - # create a parasite axes whose transData in RA, cz + # create a parasite Axes whose transData in RA, cz aux_ax = ax1.get_aux_axes(tr) aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax @@ -134,7 +134,7 @@ def setup_axes3(fig, rect): ax1.axis["top"].label.set_text(r"$\alpha_{1950}$") ax1.grid() - # create a parasite axes whose transData in RA, cz + # create a parasite Axes whose transData in RA, cz aux_ax = ax1.get_aux_axes(tr) aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax diff --git a/galleries/examples/axisartist/demo_parasite_axes.py b/galleries/examples/axisartist/demo_parasite_axes.py index fb04e1e77873..8565ef455c7e 100644 --- a/galleries/examples/axisartist/demo_parasite_axes.py +++ b/galleries/examples/axisartist/demo_parasite_axes.py @@ -3,7 +3,7 @@ Parasite Axes demo ================== -Create a parasite axes. Such axes would share the x scale with a host axes, +Create a parasite Axes. Such Axes would share the x scale with a host Axes, but show a different scale in y direction. This approach uses `mpl_toolkits.axes_grid1.parasite_axes.HostAxes` and diff --git a/galleries/examples/axisartist/simple_axisartist1.py b/galleries/examples/axisartist/simple_axisartist1.py index 4c0807d86d24..386347e142a1 100644 --- a/galleries/examples/axisartist/simple_axisartist1.py +++ b/galleries/examples/axisartist/simple_axisartist1.py @@ -19,7 +19,7 @@ from mpl_toolkits import axisartist fig = plt.figure(figsize=(6, 3), layout="constrained") -# To construct axes of two different classes, we need to use gridspec (or +# To construct Axes of two different classes, we need to use gridspec (or # MATLAB-style add_subplot calls). gs = fig.add_gridspec(1, 2) diff --git a/galleries/examples/color/colorbar_basics.py b/galleries/examples/color/colorbar_basics.py index 30fb7ed3096b..506789916637 100644 --- a/galleries/examples/color/colorbar_basics.py +++ b/galleries/examples/color/colorbar_basics.py @@ -5,7 +5,7 @@ Use `~.Figure.colorbar` by specifying the mappable object (here the `.AxesImage` returned by `~.axes.Axes.imshow`) -and the axes to attach the colorbar to. +and the Axes to attach the colorbar to. """ import matplotlib.pyplot as plt @@ -28,7 +28,7 @@ # add the colorbar using the figure's method, # telling which mappable we're talking about and -# which axes object it should be near +# which Axes object it should be near fig.colorbar(pos, ax=ax1) # repeat everything above for the negative data diff --git a/galleries/examples/event_handling/data_browser.py b/galleries/examples/event_handling/data_browser.py index c24c77ecc57f..6d9068940285 100644 --- a/galleries/examples/event_handling/data_browser.py +++ b/galleries/examples/event_handling/data_browser.py @@ -23,7 +23,7 @@ class PointBrowser: """ Click on a point to select and highlight it -- the data that - generated the point will be shown in the lower axes. Use the 'n' + generated the point will be shown in the lower Axes. Use the 'n' and 'p' keys to browse through the next and previous points """ diff --git a/galleries/examples/event_handling/pong_sgskip.py b/galleries/examples/event_handling/pong_sgskip.py index 5b26c143e7ac..e93f89580621 100644 --- a/galleries/examples/event_handling/pong_sgskip.py +++ b/galleries/examples/event_handling/pong_sgskip.py @@ -234,7 +234,7 @@ def draw(self): puck.disp.set_offsets([[puck.x, puck.y]]) self.ax.draw_artist(puck.disp) - # just redraw the axes rectangle + # just redraw the Axes rectangle self.canvas.blit(self.ax.bbox) self.canvas.flush_events() if self.cnt == 50000: diff --git a/galleries/examples/images_contours_and_fields/image_annotated_heatmap.py b/galleries/examples/images_contours_and_fields/image_annotated_heatmap.py index 1802af0e6823..23d9fd48dff8 100644 --- a/galleries/examples/images_contours_and_fields/image_annotated_heatmap.py +++ b/galleries/examples/images_contours_and_fields/image_annotated_heatmap.py @@ -114,7 +114,7 @@ def heatmap(data, row_labels, col_labels, ax=None, A list or array of length N with the labels for the columns. ax A `matplotlib.axes.Axes` instance to which the heatmap is plotted. If - not provided, use current axes or create a new one. Optional. + not provided, use current Axes or create a new one. Optional. cbar_kw A dictionary with arguments to `matplotlib.Figure.colorbar`. Optional. cbarlabel diff --git a/galleries/examples/lines_bars_and_markers/categorical_variables.py b/galleries/examples/lines_bars_and_markers/categorical_variables.py index bb42ec182ada..e28dda0dda47 100644 --- a/galleries/examples/lines_bars_and_markers/categorical_variables.py +++ b/galleries/examples/lines_bars_and_markers/categorical_variables.py @@ -20,7 +20,7 @@ # %% -# This works on both axes: +# This works on both Axes: cat = ["bored", "happy", "bored", "bored", "happy", "bored"] dog = ["happy", "happy", "happy", "happy", "bored", "bored"] diff --git a/galleries/examples/lines_bars_and_markers/eventcollection_demo.py b/galleries/examples/lines_bars_and_markers/eventcollection_demo.py index f82fb829c248..18783e1649bc 100644 --- a/galleries/examples/lines_bars_and_markers/eventcollection_demo.py +++ b/galleries/examples/lines_bars_and_markers/eventcollection_demo.py @@ -4,7 +4,7 @@ ==================== Plot two curves, then use `.EventCollection`\s to mark the locations of the x -and y data points on the respective axes for each curve. +and y data points on the respective Axes for each curve. """ import matplotlib.pyplot as plt diff --git a/galleries/examples/lines_bars_and_markers/fill_between_demo.py b/galleries/examples/lines_bars_and_markers/fill_between_demo.py index 1bdab8921415..656a8695ba18 100644 --- a/galleries/examples/lines_bars_and_markers/fill_between_demo.py +++ b/galleries/examples/lines_bars_and_markers/fill_between_demo.py @@ -113,8 +113,8 @@ # Selectively marking horizontal regions across the whole Axes # ------------------------------------------------------------ # The same selection mechanism can be applied to fill the full vertical height -# of the axes. To be independent of y-limits, we add a transform that -# interprets the x-values in data coordinates and the y-values in axes +# of the Axes. To be independent of y-limits, we add a transform that +# interprets the x-values in data coordinates and the y-values in Axes # coordinates. # # The following example marks the regions in which the y-data are above a diff --git a/galleries/examples/lines_bars_and_markers/filled_step.py b/galleries/examples/lines_bars_and_markers/filled_step.py index abc806fc5acf..65a7d31a425a 100644 --- a/galleries/examples/lines_bars_and_markers/filled_step.py +++ b/galleries/examples/lines_bars_and_markers/filled_step.py @@ -25,7 +25,7 @@ def filled_hist(ax, edges, values, bottoms=None, orientation='v', Parameters ---------- ax : Axes - The axes to plot to + The Axes to plot to. edges : array A length n+1 array giving the left edges of each bin and the @@ -85,7 +85,7 @@ def stack_hist(ax, stacked_data, sty_cycle, bottoms=None, Parameters ---------- ax : axes.Axes - The axes to add artists too + The Axes to add artists to. stacked_data : array or Mapping A (M, N) shaped array. The first dimension will be iterated over to diff --git a/galleries/examples/lines_bars_and_markers/gradient_bar.py b/galleries/examples/lines_bars_and_markers/gradient_bar.py index 1c61a4bb908e..4cd86f26590f 100644 --- a/galleries/examples/lines_bars_and_markers/gradient_bar.py +++ b/galleries/examples/lines_bars_and_markers/gradient_bar.py @@ -30,7 +30,7 @@ def gradient_image(ax, direction=0.3, cmap_range=(0, 1), **kwargs): Parameters ---------- ax : Axes - The axes to draw on. + The Axes to draw on. direction : float The direction of the gradient. This is a number in range 0 (=vertical) to 1 (=horizontal). diff --git a/galleries/examples/lines_bars_and_markers/scatter_hist.py b/galleries/examples/lines_bars_and_markers/scatter_hist.py index 9e4598a15957..95a373961aa1 100644 --- a/galleries/examples/lines_bars_and_markers/scatter_hist.py +++ b/galleries/examples/lines_bars_and_markers/scatter_hist.py @@ -6,23 +6,23 @@ Show the marginal distributions of a scatter plot as histograms at the sides of the plot. -For a nice alignment of the main axes with the marginals, two options are shown +For a nice alignment of the main Axes with the marginals, two options are shown below: .. contents:: :local: While `.Axes.inset_axes` may be a bit more complex, it allows correct handling -of main axes with a fixed aspect ratio. +of main Axes with a fixed aspect ratio. An alternative method to produce a similar figure using the ``axes_grid1`` toolkit is shown in the :doc:`/gallery/axes_grid1/scatter_hist_locatable_axes` -example. Finally, it is also possible to position all axes in absolute +example. Finally, it is also possible to position all Axes in absolute coordinates using `.Figure.add_axes` (not shown here). Let us first define a function that takes x and y data as input, as well -as three axes, the main axes for the scatter, and two marginal axes. It will -then create the scatter and histograms inside the provided axes. +as three Axes, the main Axes for the scatter, and two marginal Axes. It will +then create the scatter and histograms inside the provided Axes. """ import matplotlib.pyplot as plt @@ -56,7 +56,7 @@ def scatter_hist(x, y, ax, ax_histx, ax_histy): # %% # -# Defining the axes positions using a gridspec +# Defining the Axes positions using a gridspec # -------------------------------------------- # # We define a gridspec with unequal width- and height-ratios to achieve desired @@ -65,7 +65,7 @@ def scatter_hist(x, y, ax, ax_histx, ax_histy): # Start with a square Figure. fig = plt.figure(figsize=(6, 6)) # Add a gridspec with two rows and two columns and a ratio of 1 to 4 between -# the size of the marginal axes and the main axes in both directions. +# the size of the marginal Axes and the main Axes in both directions. # Also adjust the subplot parameters for a square plot. gs = fig.add_gridspec(2, 2, width_ratios=(4, 1), height_ratios=(1, 4), left=0.1, right=0.9, bottom=0.1, top=0.9, @@ -80,26 +80,26 @@ def scatter_hist(x, y, ax, ax_histx, ax_histy): # %% # -# Defining the axes positions using inset_axes +# Defining the Axes positions using inset_axes # -------------------------------------------- # # `~.Axes.inset_axes` can be used to position marginals *outside* the main -# axes. The advantage of doing so is that the aspect ratio of the main axes +# Axes. The advantage of doing so is that the aspect ratio of the main Axes # can be fixed, and the marginals will always be drawn relative to the position -# of the axes. +# of the Axes. # Create a Figure, which doesn't have to be square. fig = plt.figure(layout='constrained') -# Create the main axes, leaving 25% of the figure space at the top and on the +# Create the main Axes, leaving 25% of the figure space at the top and on the # right to position marginals. ax = fig.add_gridspec(top=0.75, right=0.75).subplots() -# The main axes' aspect can be fixed. +# The main Axes' aspect can be fixed. ax.set(aspect=1) -# Create marginal axes, which have 25% of the size of the main axes. Note that -# the inset axes are positioned *outside* (on the right and the top) of the -# main axes, by specifying axes coordinates greater than 1. Axes coordinates +# Create marginal Axes, which have 25% of the size of the main Axes. Note that +# the inset Axes are positioned *outside* (on the right and the top) of the +# main Axes, by specifying axes coordinates greater than 1. Axes coordinates # less than 0 would likewise specify positions on the left and the bottom of -# the main axes. +# the main Axes. ax_histx = ax.inset_axes([0, 1.05, 1, 0.25], sharex=ax) ax_histy = ax.inset_axes([1.05, 0, 0.25, 1], sharey=ax) # Draw the scatter plot and marginals. diff --git a/galleries/examples/lines_bars_and_markers/vline_hline_demo.py b/galleries/examples/lines_bars_and_markers/vline_hline_demo.py index 564d44ce7401..c2f5d025b15c 100644 --- a/galleries/examples/lines_bars_and_markers/vline_hline_demo.py +++ b/galleries/examples/lines_bars_and_markers/vline_hline_demo.py @@ -21,7 +21,7 @@ vax.plot(t, s + nse, '^') vax.vlines(t, [0], s) # By using ``transform=vax.get_xaxis_transform()`` the y coordinates are scaled -# such that 0 maps to the bottom of the axes and 1 to the top. +# such that 0 maps to the bottom of the Axes and 1 to the top. vax.vlines([1, 2], 0, 1, transform=vax.get_xaxis_transform(), colors='r') vax.set_xlabel('time (s)') vax.set_title('Vertical lines demo') diff --git a/galleries/examples/misc/coords_report.py b/galleries/examples/misc/coords_report.py index 127ce712fc1e..84503be35c5f 100644 --- a/galleries/examples/misc/coords_report.py +++ b/galleries/examples/misc/coords_report.py @@ -3,7 +3,7 @@ Coords Report ============= -Override the default reporting of coords as the mouse moves over the axes +Override the default reporting of coords as the mouse moves over the Axes in an interactive backend. """ diff --git a/galleries/examples/misc/custom_projection.py b/galleries/examples/misc/custom_projection.py index e63ba8771ee1..1bd4ce772b0a 100644 --- a/galleries/examples/misc/custom_projection.py +++ b/galleries/examples/misc/custom_projection.py @@ -90,7 +90,7 @@ def _set_lim_and_transforms(self): # the inline documentation there. # The goal of the first two transformations is to get from the - # data space (in this case longitude and latitude) to axes + # data space (in this case longitude and latitude) to Axes # space. It is separated into a non-affine and affine part so # that the non-affine part does not have to be recomputed when # a simple affine change to the figure has been made (such as @@ -102,12 +102,12 @@ def _set_lim_and_transforms(self): # 2) The above has an output range that is not in the unit # rectangle, so scale and translate it so it fits correctly - # within the axes. The peculiar calculations of xscale and + # within the Axes. The peculiar calculations of xscale and # yscale are specific to an Aitoff-Hammer projection, so don't # worry about them too much. self.transAffine = self._get_affine_transform() - # 3) This is the transformation from axes space to display + # 3) This is the transformation from Axes space to display # space. self.transAxes = BboxTransformTo(self.bbox) @@ -125,7 +125,7 @@ def _set_lim_and_transforms(self): # gridlines and tick labels. # Longitude gridlines and ticklabels. The input to these - # transforms are in display space in x and axes space in y. + # transforms are in display space in x and Axes space in y. # Therefore, the input values will be in range (-xmin, 0), # (xmax, 1). The goal of these transforms is to go from that # space to display space. The tick labels will be offset 4 @@ -147,11 +147,11 @@ def _set_lim_and_transforms(self): Affine2D().translate(0.0, -4.0) # Now set up the transforms for the latitude ticks. The input to - # these transforms are in axes space in x and display space in + # these transforms are in Axes space in x and display space in # y. Therefore, the input values will be in range (0, -ymin), # (1, ymax). The goal of these transforms is to go from that # space to display space. The tick labels will be offset 4 - # pixels from the edge of the axes ellipse. + # pixels from the edge of the Axes ellipse. yaxis_stretch = Affine2D().scale(np.pi*2, 1).translate(-np.pi, 0) yaxis_space = Affine2D().scale(1.0, 1.1) self._yaxis_transform = \ @@ -235,7 +235,7 @@ def _gen_axes_patch(self): Override this method to define the shape that is used for the background of the plot. It should be a subclass of Patch. - In this case, it is a Circle (that may be warped by the axes + In this case, it is a Circle (that may be warped by the Axes transform into an ellipse). Any data and gridlines will be clipped to this shape. """ diff --git a/galleries/examples/misc/fig_x.py b/galleries/examples/misc/fig_x.py index 2985c2f1cffc..e2af3e766028 100644 --- a/galleries/examples/misc/fig_x.py +++ b/galleries/examples/misc/fig_x.py @@ -3,7 +3,7 @@ Adding lines to figures ======================= -Adding lines to a figure without any axes. +Adding lines to a figure without any Axes. .. redirect-from:: /gallery/pyplots/fig_x """ diff --git a/galleries/examples/misc/logos2.py b/galleries/examples/misc/logos2.py index 3a070535f83f..aca348474e7b 100644 --- a/galleries/examples/misc/logos2.py +++ b/galleries/examples/misc/logos2.py @@ -36,7 +36,7 @@ def get_font_properties(): def create_icon_axes(fig, ax_position, lw_bars, lw_grid, lw_border, rgrid): """ - Create a polar axes containing the matplotlib radar plot. + Create a polar Axes containing the matplotlib radar plot. Parameters ---------- diff --git a/galleries/examples/misc/rasterization_demo.py b/galleries/examples/misc/rasterization_demo.py index 7755e66745cb..ce0cf02dfac2 100644 --- a/galleries/examples/misc/rasterization_demo.py +++ b/galleries/examples/misc/rasterization_demo.py @@ -9,7 +9,7 @@ Whether rasterization should be used can be specified per artist. This can be useful to reduce the file size of large artists, while maintaining the -advantages of vector graphics for other artists such as the axes +advantages of vector graphics for other artists such as the Axes and text. For instance a complicated `~.Axes.pcolormesh` or `~.Axes.contourf` can be made significantly simpler by rasterizing. Setting rasterization only affects vector backends such as PDF, SVG, or PS. diff --git a/galleries/examples/misc/svg_filter_pie.py b/galleries/examples/misc/svg_filter_pie.py index 052cde48a245..b823cc9670c9 100644 --- a/galleries/examples/misc/svg_filter_pie.py +++ b/galleries/examples/misc/svg_filter_pie.py @@ -17,7 +17,7 @@ from matplotlib.patches import Shadow -# make a square figure and axes +# make a square figure and Axes fig = plt.figure(figsize=(6, 6)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) diff --git a/galleries/examples/misc/table_demo.py b/galleries/examples/misc/table_demo.py index 71fb98343d3f..c89fb5cf83df 100644 --- a/galleries/examples/misc/table_demo.py +++ b/galleries/examples/misc/table_demo.py @@ -40,7 +40,7 @@ colors = colors[::-1] cell_text.reverse() -# Add a table at the bottom of the axes +# Add a table at the bottom of the Axes the_table = plt.table(cellText=cell_text, rowLabels=rows, rowColours=colors, diff --git a/galleries/examples/misc/transoffset.py b/galleries/examples/misc/transoffset.py index 5254974b46e6..b3163e8df703 100644 --- a/galleries/examples/misc/transoffset.py +++ b/galleries/examples/misc/transoffset.py @@ -31,7 +31,7 @@ # If we want the same offset for each text instance, # we only need to make one transform. To get the -# transform argument to offset_copy, we need to make the axes +# transform argument to offset_copy, we need to make the Axes # first; the subplot function above is one way to do this. trans_offset = mtransforms.offset_copy(ax.transData, fig=fig, x=0.05, y=0.10, units='inches') diff --git a/galleries/examples/misc/zorder_demo.py b/galleries/examples/misc/zorder_demo.py index 36c5e7965ba2..e077dc56d2d0 100644 --- a/galleries/examples/misc/zorder_demo.py +++ b/galleries/examples/misc/zorder_demo.py @@ -15,7 +15,7 @@ `.Patch`, `.PatchCollection` 1 `.Line2D`, `.LineCollection` (including minor ticks, grid lines) 2 Major ticks 2.01 -`.Text` (including axes labels and titles) 3 +`.Text` (including Axes labels and titles) 3 `.Legend` 5 ================================================================ ======= diff --git a/galleries/examples/mplot3d/3d_bars.py b/galleries/examples/mplot3d/3d_bars.py index 609adb8df380..40a09ae33f68 100644 --- a/galleries/examples/mplot3d/3d_bars.py +++ b/galleries/examples/mplot3d/3d_bars.py @@ -9,7 +9,7 @@ import matplotlib.pyplot as plt import numpy as np -# set up the figure and axes +# set up the figure and Axes fig = plt.figure(figsize=(8, 3)) ax1 = fig.add_subplot(121, projection='3d') ax2 = fig.add_subplot(122, projection='3d') diff --git a/galleries/examples/mplot3d/mixed_subplots.py b/galleries/examples/mplot3d/mixed_subplots.py index 963044020f47..dc196f05f90d 100644 --- a/galleries/examples/mplot3d/mixed_subplots.py +++ b/galleries/examples/mplot3d/mixed_subplots.py @@ -1,6 +1,6 @@ """ ============================= -2D and 3D axes in same figure +2D and 3D Axes in same figure ============================= This example shows a how to plot a 2D and a 3D plot on the same figure. diff --git a/galleries/examples/mplot3d/pathpatch3d.py b/galleries/examples/mplot3d/pathpatch3d.py index f195e19e17a9..335b68003d31 100644 --- a/galleries/examples/mplot3d/pathpatch3d.py +++ b/galleries/examples/mplot3d/pathpatch3d.py @@ -17,7 +17,7 @@ def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs): """ - Plots the string *s* on the axes *ax*, with position *xyz*, size *size*, + Plots the string *s* on the Axes *ax*, with position *xyz*, size *size*, and rotation angle *angle*. *zdir* gives the axis which is to be treated as the third dimension. *usetex* is a boolean indicating whether the string should be run through a LaTeX subprocess or not. Any additional keyword diff --git a/galleries/examples/mplot3d/subplot3d.py b/galleries/examples/mplot3d/subplot3d.py index 1dfeeb216f58..47e374dc74b9 100644 --- a/galleries/examples/mplot3d/subplot3d.py +++ b/galleries/examples/mplot3d/subplot3d.py @@ -18,7 +18,7 @@ # ============= # First subplot # ============= -# set up the axes for the first plot +# set up the Axes for the first plot ax = fig.add_subplot(1, 2, 1, projection='3d') # plot a 3D surface like in the example mplot3d/surface3d_demo @@ -35,7 +35,7 @@ # ============== # Second subplot # ============== -# set up the axes for the second plot +# set up the Axes for the second plot ax = fig.add_subplot(1, 2, 2, projection='3d') # plot a 3D wireframe like in the example mplot3d/wire3d_demo diff --git a/galleries/examples/pie_and_polar_charts/bar_of_pie.py b/galleries/examples/pie_and_polar_charts/bar_of_pie.py index f386f11bc9aa..ef68b3d79971 100644 --- a/galleries/examples/pie_and_polar_charts/bar_of_pie.py +++ b/galleries/examples/pie_and_polar_charts/bar_of_pie.py @@ -6,7 +6,7 @@ Make a "bar of pie" chart where the first slice of the pie is "exploded" into a bar chart with a further breakdown of said slice's characteristics. The example demonstrates using a figure with multiple -sets of axes and using the axes patches list to add two ConnectionPatches +sets of Axes and using the Axes patches list to add two ConnectionPatches to link the subplot charts. """ diff --git a/galleries/examples/pie_and_polar_charts/nested_pie.py b/galleries/examples/pie_and_polar_charts/nested_pie.py index 8331618fe45c..c83b4f6f84ee 100644 --- a/galleries/examples/pie_and_polar_charts/nested_pie.py +++ b/galleries/examples/pie_and_polar_charts/nested_pie.py @@ -46,7 +46,7 @@ # %% # However, you can accomplish the same output by using a bar plot on -# axes with a polar coordinate system. This may give more flexibility on +# Axes with a polar coordinate system. This may give more flexibility on # the exact design of the plot. # # In this case, we need to map x-values of the bar chart onto radians of diff --git a/galleries/examples/pie_and_polar_charts/polar_legend.py b/galleries/examples/pie_and_polar_charts/polar_legend.py index a4508b0e9f3a..7972b0aaffd4 100644 --- a/galleries/examples/pie_and_polar_charts/polar_legend.py +++ b/galleries/examples/pie_and_polar_charts/polar_legend.py @@ -17,9 +17,9 @@ ax.plot(theta, r, color="tab:orange", lw=3, label="a line") ax.plot(0.5 * theta, r, color="tab:blue", ls="--", lw=3, label="another line") ax.tick_params(grid_color="palegoldenrod") -# For polar axes, it may be useful to move the legend slightly away from the -# axes center, to avoid overlap between the legend and the axes. The following -# snippet places the legend's lower left corner just outside the polar axes +# For polar Axes, it may be useful to move the legend slightly away from the +# Axes center, to avoid overlap between the legend and the Axes. The following +# snippet places the legend's lower left corner just outside the polar Axes # at an angle of 67.5 degrees in polar coordinates. angle = np.deg2rad(67.5) ax.legend(loc="lower left", diff --git a/galleries/examples/pyplots/pyplot_text.py b/galleries/examples/pyplots/pyplot_text.py index 9fb9f4f1608c..72f977c2f985 100644 --- a/galleries/examples/pyplots/pyplot_text.py +++ b/galleries/examples/pyplots/pyplot_text.py @@ -5,7 +5,7 @@ Set the special text objects `~.pyplot.title`, `~.pyplot.xlabel`, and `~.pyplot.ylabel` through the dedicated pyplot functions. Additional text -objects can be placed in the axes using `~.pyplot.text`. +objects can be placed in the Axes using `~.pyplot.text`. You can use TeX-like mathematical typesetting in all texts; see also :ref:`mathtext`. diff --git a/galleries/examples/shapes_and_collections/arrow_guide.py b/galleries/examples/shapes_and_collections/arrow_guide.py index 7ca969b7b190..d9fad893a873 100644 --- a/galleries/examples/shapes_and_collections/arrow_guide.py +++ b/galleries/examples/shapes_and_collections/arrow_guide.py @@ -69,7 +69,7 @@ # change shape or position if you pan or scale the plot. # # In this case we use `.patches.FancyArrowPatch`, and pass the keyword argument -# ``transform=ax.transAxes`` where ``ax`` is the axes we are adding the patch +# ``transform=ax.transAxes`` where ``ax`` is the Axes we are adding the patch # to. # # Note that when the axis limits are changed, the arrow shape and location diff --git a/galleries/examples/shapes_and_collections/fancybox_demo.py b/galleries/examples/shapes_and_collections/fancybox_demo.py index 49692c1be5e6..91cc1d1749ea 100644 --- a/galleries/examples/shapes_and_collections/fancybox_demo.py +++ b/galleries/examples/shapes_and_collections/fancybox_demo.py @@ -90,7 +90,7 @@ def draw_control_points_for_patches(ax): title='boxstyle="round,pad=0.1"\n mutation_scale=2') ax = axs[1, 1] -# When the aspect ratio of the axes is not 1, the fancy box may not be what you +# When the aspect ratio of the Axes is not 1, the fancy box may not be what you # expected (green). fancy = add_fancy_patch_around(ax, bb, boxstyle="round,pad=0.2") fancy.set(facecolor="none", edgecolor="green") diff --git a/galleries/examples/shapes_and_collections/patch_collection.py b/galleries/examples/shapes_and_collections/patch_collection.py index 8ac9c3a7c304..ca0dd8e1045d 100644 --- a/galleries/examples/shapes_and_collections/patch_collection.py +++ b/galleries/examples/shapes_and_collections/patch_collection.py @@ -6,7 +6,7 @@ This example demonstrates how to use `.collections.PatchCollection`. See also :doc:`/gallery/shapes_and_collections/artist_reference`, which instead -adds each artist separately to its own axes. +adds each artist separately to its own Axes. """ import matplotlib.pyplot as plt diff --git a/galleries/examples/specialty_plots/leftventricle_bullseye.py b/galleries/examples/specialty_plots/leftventricle_bullseye.py index 70327f49c054..e3c3d52fa6a5 100644 --- a/galleries/examples/specialty_plots/leftventricle_bullseye.py +++ b/galleries/examples/specialty_plots/leftventricle_bullseye.py @@ -23,7 +23,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap="viridis", norm=None): Parameters ---------- - ax : axes + ax : Axes data : list[float] The intensity values for each of the 17 segments. seg_bold : list[int], optional @@ -95,7 +95,7 @@ def bullseye_plot(ax, data, seg_bold=None, cmap="viridis", norm=None): data = np.arange(17) + 1 -# Make a figure and axes with dimensions as desired. +# Make a figure and Axes with dimensions as desired. fig = plt.figure(figsize=(10, 5), layout="constrained") fig.get_layout_engine().set(wspace=.1, w_pad=.2) axs = fig.subplots(1, 3, subplot_kw=dict(projection='polar')) diff --git a/galleries/examples/specialty_plots/radar_chart.py b/galleries/examples/specialty_plots/radar_chart.py index 3d17659d0bdf..a2f6df717544 100644 --- a/galleries/examples/specialty_plots/radar_chart.py +++ b/galleries/examples/specialty_plots/radar_chart.py @@ -9,7 +9,7 @@ frames don't have proper gridlines (the lines are circles instead of polygons). It's possible to get a polygon grid by setting GRIDLINE_INTERPOLATION_STEPS in `matplotlib.axis` to the desired number of vertices, but the orientation of the -polygon is not aligned with the radial axes. +polygon is not aligned with the radial axis. .. [1] https://en.wikipedia.org/wiki/Radar_chart """ @@ -27,7 +27,7 @@ def radar_factory(num_vars, frame='circle'): """ - Create a radar chart with `num_vars` axes. + Create a radar chart with `num_vars` Axes. This function creates a RadarAxes projection and registers it. @@ -36,7 +36,7 @@ def radar_factory(num_vars, frame='circle'): num_vars : int Number of variables for radar chart. frame : {'circle', 'polygon'} - Shape of frame surrounding axes. + Shape of frame surrounding Axes. """ # calculate evenly-spaced axis angles @@ -177,7 +177,7 @@ def example_data(): fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.85, bottom=0.05) colors = ['b', 'r', 'g', 'm', 'y'] - # Plot the four cases from the example data on separate axes + # Plot the four cases from the example data on separate Axes for ax, (title, case_data) in zip(axs.flat, data): ax.set_rgrids([0.2, 0.4, 0.6, 0.8]) ax.set_title(title, weight='bold', size='medium', position=(0.5, 1.1), diff --git a/galleries/examples/spines/centered_spines_with_arrows.py b/galleries/examples/spines/centered_spines_with_arrows.py index 972e7ebd5e4e..f71d071a5f82 100644 --- a/galleries/examples/spines/centered_spines_with_arrows.py +++ b/galleries/examples/spines/centered_spines_with_arrows.py @@ -21,7 +21,7 @@ # case, one of the coordinates (0) is a data coordinate (i.e., y = 0 or x = 0, # respectively) and the other one (1) is an axes coordinate (i.e., at the very # right/top of the axes). Also, disable clipping (clip_on=False) as the marker -# actually spills out of the axes. +# actually spills out of the Axes. ax.plot(1, 0, ">k", transform=ax.get_yaxis_transform(), clip_on=False) ax.plot(0, 1, "^k", transform=ax.get_xaxis_transform(), clip_on=False) diff --git a/galleries/examples/spines/multiple_yaxis_with_spines.py b/galleries/examples/spines/multiple_yaxis_with_spines.py index c1dc95a62612..a0281bdeda0f 100644 --- a/galleries/examples/spines/multiple_yaxis_with_spines.py +++ b/galleries/examples/spines/multiple_yaxis_with_spines.py @@ -4,11 +4,11 @@ =========================== Create multiple y axes with a shared x-axis. This is done by creating -a `~.axes.Axes.twinx` axes, turning all spines but the right one invisible +a `~.axes.Axes.twinx` Axes, turning all spines but the right one invisible and offset its position using `~.spines.Spine.set_position`. Note that this approach uses `matplotlib.axes.Axes` and their -`~matplotlib.spines.Spine`\s. Alternative approaches using non-standard axes +`~matplotlib.spines.Spine`\s. Alternative approaches using non-standard Axes are shown in the :doc:`/gallery/axisartist/demo_parasite_axes` and :doc:`/gallery/axisartist/demo_parasite_axes2` examples. """ diff --git a/galleries/examples/spines/spines.py b/galleries/examples/spines/spines.py index fd42292112fd..2e28fb546d86 100644 --- a/galleries/examples/spines/spines.py +++ b/galleries/examples/spines/spines.py @@ -21,7 +21,7 @@ x = np.linspace(0, 2 * np.pi, 100) y = 2 * np.sin(x) -# Constrained layout makes sure the labels don't overlap the axes. +# Constrained layout makes sure the labels don't overlap the Axes. fig, (ax0, ax1, ax2) = plt.subplots(nrows=3, layout='constrained') ax0.plot(x, y) diff --git a/galleries/examples/spines/spines_dropped.py b/galleries/examples/spines/spines_dropped.py index 3adeee92ba37..015d6094d758 100644 --- a/galleries/examples/spines/spines_dropped.py +++ b/galleries/examples/spines/spines_dropped.py @@ -3,7 +3,7 @@ Dropped spines ============== -Demo of spines offset from the axes (a.k.a. "dropped spines"). +Demo of spines offset from the Axes (a.k.a. "dropped spines"). """ import matplotlib.pyplot as plt import numpy as np diff --git a/galleries/examples/statistics/boxplot.py b/galleries/examples/statistics/boxplot.py index 419352380c76..79b05386c5d9 100644 --- a/galleries/examples/statistics/boxplot.py +++ b/galleries/examples/statistics/boxplot.py @@ -8,7 +8,7 @@ individual components (note that the mean is the only value not shown by default). The second figure demonstrates how the styles of the artists can be customized. It also demonstrates how to set the limit of the whiskers to -specific percentiles (lower right axes) +specific percentiles (lower right Axes) A good general reference on boxplots and their history can be found here: https://vita.had.co.nz/papers/boxplots.pdf diff --git a/galleries/examples/statistics/confidence_ellipse.py b/galleries/examples/statistics/confidence_ellipse.py index 2a0427127773..27b06146a44e 100644 --- a/galleries/examples/statistics/confidence_ellipse.py +++ b/galleries/examples/statistics/confidence_ellipse.py @@ -30,7 +30,7 @@ # # This function plots the confidence ellipse of the covariance of the given # array-like variables x and y. The ellipse is plotted into the given -# axes-object ax. +# Axes object *ax*. # # The radiuses of the ellipse can be controlled by n_std which is the number # of standard deviations. The default value is 3 which makes the ellipse @@ -49,7 +49,7 @@ def confidence_ellipse(x, y, ax, n_std=3.0, facecolor='none', **kwargs): Input data. ax : matplotlib.axes.Axes - The axes object to draw the ellipse into. + The Axes object to draw the ellipse into. n_std : float The number of standard deviations to determine the ellipse's radiuses. diff --git a/galleries/examples/statistics/errorbars_and_boxes.py b/galleries/examples/statistics/errorbars_and_boxes.py index c182d53a701a..54c8786096c7 100644 --- a/galleries/examples/statistics/errorbars_and_boxes.py +++ b/galleries/examples/statistics/errorbars_and_boxes.py @@ -51,7 +51,7 @@ def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r', pc = PatchCollection(errorboxes, facecolor=facecolor, alpha=alpha, edgecolor=edgecolor) - # Add collection to axes + # Add collection to Axes ax.add_collection(pc) # Plot errorbars @@ -61,7 +61,7 @@ def make_error_boxes(ax, xdata, ydata, xerror, yerror, facecolor='r', return artists -# Create figure and axes +# Create figure and Axes fig, ax = plt.subplots(1) # Call function to create error boxes diff --git a/galleries/examples/subplots_axes_and_figures/axes_box_aspect.py b/galleries/examples/subplots_axes_and_figures/axes_box_aspect.py index 9ad5a14b7649..64824206b5f8 100644 --- a/galleries/examples/subplots_axes_and_figures/axes_box_aspect.py +++ b/galleries/examples/subplots_axes_and_figures/axes_box_aspect.py @@ -4,8 +4,8 @@ =============== This demo shows how to set the aspect of an Axes box directly via -`~.Axes.set_box_aspect`. The box aspect is the ratio between axes height -and axes width in physical units, independent of the data limits. +`~.Axes.set_box_aspect`. The box aspect is the ratio between Axes height +and Axes width in physical units, independent of the data limits. This is useful to e.g. produce a square plot, independent of the data it contains, or to have a usual plot with the same axes dimensions next to an image plot with fixed (data-)aspect. @@ -14,10 +14,10 @@ """ # %% -# A square axes, independent of data +# A square Axes, independent of data # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Produce a square axes, no matter what the data limits are. +# Produce a square Axes, no matter what the data limits are. import matplotlib.pyplot as plt import numpy as np @@ -30,7 +30,7 @@ plt.show() # %% -# Shared square axes +# Shared square Axes # ~~~~~~~~~~~~~~~~~~ # # Produce shared subplots that are squared in size. @@ -46,10 +46,10 @@ plt.show() # %% -# Square twin axes +# Square twin Axes # ~~~~~~~~~~~~~~~~ # -# Produce a square axes, with a twin axes. The twinned axes takes over the +# Produce a square Axes, with a twin Axes. The twinned Axes takes over the # box aspect of the parent. # @@ -70,9 +70,9 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~ # # When creating an image plot with fixed data aspect and the default -# ``adjustable="box"`` next to a normal plot, the axes would be unequal in +# ``adjustable="box"`` next to a normal plot, the Axes would be unequal in # height. `~.Axes.set_box_aspect` provides an easy solution to that by allowing -# to have the normal plot's axes use the images dimensions as box aspect. +# to have the normal plot's Axes use the images dimensions as box aspect. # # This example also shows that *constrained layout* interplays nicely with # a fixed box aspect. @@ -94,8 +94,8 @@ # # It may be desirable to show marginal distributions next to a plot of joint # data. The following creates a square plot with the box aspect of the -# marginal axes being equal to the width- and height-ratios of the gridspec. -# This ensures that all axes align perfectly, independent on the size of the +# marginal Axes being equal to the width- and height-ratios of the gridspec. +# This ensures that all Axes align perfectly, independent on the size of the # figure. fig5, axs = plt.subplots(2, 2, sharex="col", sharey="row", diff --git a/galleries/examples/subplots_axes_and_figures/axes_demo.py b/galleries/examples/subplots_axes_and_figures/axes_demo.py index 46a353d7475b..f5620a9a980d 100644 --- a/galleries/examples/subplots_axes_and_figures/axes_demo.py +++ b/galleries/examples/subplots_axes_and_figures/axes_demo.py @@ -3,7 +3,7 @@ Axes Demo ========= -Example use of ``fig.add_axes`` to create inset axes within the main plot axes. +Example use of ``fig.add_axes`` to create inset Axes within the main plot Axes. Please see also the :ref:`axes_grid_examples` section, and the following three examples: @@ -32,12 +32,12 @@ main_ax.set_ylabel('current (nA)') main_ax.set_title('Gaussian colored noise') -# this is an inset axes over the main axes +# this is an inset Axes over the main Axes right_inset_ax = fig.add_axes([.65, .6, .2, .2], facecolor='k') right_inset_ax.hist(s, 400, density=True) right_inset_ax.set(title='Probability', xticks=[], yticks=[]) -# this is another inset axes over the main axes +# this is another inset Axes over the main Axes left_inset_ax = fig.add_axes([.2, .6, .2, .2], facecolor='k') left_inset_ax.plot(t[:len(r)], r) left_inset_ax.set(title='Impulse response', xlim=(0, .2), xticks=[], yticks=[]) diff --git a/galleries/examples/subplots_axes_and_figures/axes_margins.py b/galleries/examples/subplots_axes_and_figures/axes_margins.py index 934e5ac6366b..dd113c8c34e0 100644 --- a/galleries/examples/subplots_axes_and_figures/axes_margins.py +++ b/galleries/examples/subplots_axes_and_figures/axes_margins.py @@ -58,7 +58,7 @@ def f(t): ] fig, (ax1, ax2) = plt.subplots(ncols=2) -# Here we set the stickiness of the axes object... +# Here we set the stickiness of the Axes object... # ax1 we'll leave as the default, which uses sticky edges # and we'll turn off stickiness for ax2 ax2.use_sticky_edges = False diff --git a/galleries/examples/subplots_axes_and_figures/axes_zoom_effect.py b/galleries/examples/subplots_axes_and_figures/axes_zoom_effect.py index a8076db48528..49a44b9e4f43 100644 --- a/galleries/examples/subplots_axes_and_figures/axes_zoom_effect.py +++ b/galleries/examples/subplots_axes_and_figures/axes_zoom_effect.py @@ -42,17 +42,17 @@ def connect_bbox(bbox1, bbox2, def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs): """ - Connect *ax1* and *ax2*. The *xmin*-to-*xmax* range in both axes will + Connect *ax1* and *ax2*. The *xmin*-to-*xmax* range in both Axes will be marked. Parameters ---------- ax1 - The main axes. + The main Axes. ax2 - The zoomed axes. + The zoomed Axes. xmin, xmax - The limits of the colored area in both plot axes. + The limits of the colored area in both plot Axes. **kwargs Arguments passed to the patch constructor. """ @@ -80,8 +80,8 @@ def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs): def zoom_effect02(ax1, ax2, **kwargs): """ - ax1 : the main axes - ax1 : the zoomed axes + ax1 : the main Axes + ax1 : the zoomed Axes Similar to zoom_effect01. The xmin & xmax will be taken from the ax1.viewLim. diff --git a/galleries/examples/subplots_axes_and_figures/axhspan_demo.py b/galleries/examples/subplots_axes_and_figures/axhspan_demo.py index bc1d7bff154b..e297f4adf462 100644 --- a/galleries/examples/subplots_axes_and_figures/axhspan_demo.py +++ b/galleries/examples/subplots_axes_and_figures/axhspan_demo.py @@ -3,8 +3,8 @@ axhspan Demo ============ -Create lines or rectangles that span the axes in either the horizontal or -vertical direction, and lines than span the axes with an arbitrary orientation. +Create lines or rectangles that span the Axes in either the horizontal or +vertical direction, and lines than span the Axes with an arbitrary orientation. """ import matplotlib.pyplot as plt @@ -24,13 +24,13 @@ ax.axvline(x=1) # Thick blue vertical line at x=0 that spans the upper quadrant of the yrange. ax.axvline(x=0, ymin=0.75, linewidth=8, color='#1f77b4') -# Default hline at y=.5 that spans the middle half of the axes. +# Default hline at y=.5 that spans the middle half of the Axes. ax.axhline(y=.5, xmin=0.25, xmax=0.75) # Infinite black line going through (0, 0) to (1, 1). ax.axline((0, 0), (1, 1), color='k') -# 50%-gray rectangle spanning the axes' width from y=0.25 to y=0.75. +# 50%-gray rectangle spanning the Axes' width from y=0.25 to y=0.75. ax.axhspan(0.25, 0.75, facecolor='0.5') -# Green rectangle spanning the axes' height from x=1.25 to x=1.55. +# Green rectangle spanning the Axes' height from x=1.25 to x=1.55. ax.axvspan(1.25, 1.55, facecolor='#2ca02c') plt.show() diff --git a/galleries/examples/subplots_axes_and_figures/broken_axis.py b/galleries/examples/subplots_axes_and_figures/broken_axis.py index 343fe5d4865b..06263b9c120a 100644 --- a/galleries/examples/subplots_axes_and_figures/broken_axis.py +++ b/galleries/examples/subplots_axes_and_figures/broken_axis.py @@ -20,9 +20,9 @@ # into two portions - use the top (ax1) for the outliers, and the bottom # (ax2) for the details of the majority of our data fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) -fig.subplots_adjust(hspace=0.05) # adjust space between axes +fig.subplots_adjust(hspace=0.05) # adjust space between Axes -# plot the same data on both axes +# plot the same data on both Axes ax1.plot(pts) ax2.plot(pts) @@ -39,9 +39,9 @@ # Now, let's turn towards the cut-out slanted lines. # We create line objects in axes coordinates, in which (0,0), (0,1), -# (1,0), and (1,1) are the four corners of the axes. +# (1,0), and (1,1) are the four corners of the Axes. # The slanted lines themselves are markers at those locations, such that the -# lines keep their angle and position, independent of the axes size or scale +# lines keep their angle and position, independent of the Axes size or scale # Finally, we need to disable clipping. d = .5 # proportion of vertical to horizontal extent of the slanted line diff --git a/galleries/examples/subplots_axes_and_figures/demo_constrained_layout.py b/galleries/examples/subplots_axes_and_figures/demo_constrained_layout.py index f16f419ece7a..9a67541e554e 100644 --- a/galleries/examples/subplots_axes_and_figures/demo_constrained_layout.py +++ b/galleries/examples/subplots_axes_and_figures/demo_constrained_layout.py @@ -1,11 +1,11 @@ """ ===================================== -Resizing axes with constrained layout +Resizing Axes with constrained layout ===================================== *Constrained layout* attempts to resize subplots in -a figure so that there are no overlaps between axes objects and labels -on the axes. +a figure so that there are no overlaps between Axes objects and labels +on the Axes. See :ref:`constrainedlayout_guide` for more details and :ref:`tight_layout_guide` for an alternative. @@ -23,7 +23,7 @@ def example_plot(ax): # %% -# If we don't use *constrained layout*, then labels overlap the axes +# If we don't use *constrained layout*, then labels overlap the Axes fig, axs = plt.subplots(nrows=2, ncols=2, layout=None) diff --git a/galleries/examples/subplots_axes_and_figures/demo_tight_layout.py b/galleries/examples/subplots_axes_and_figures/demo_tight_layout.py index 0cc5f5301db4..7ac3a7376d67 100644 --- a/galleries/examples/subplots_axes_and_figures/demo_tight_layout.py +++ b/galleries/examples/subplots_axes_and_figures/demo_tight_layout.py @@ -1,10 +1,10 @@ """ =============================== -Resizing axes with tight layout +Resizing Axes with tight layout =============================== `~.Figure.tight_layout` attempts to resize subplots in a figure so that there -are no overlaps between axes objects and labels on the axes. +are no overlaps between Axes objects and labels on the Axes. See :ref:`tight_layout_guide` for more details and :ref:`constrainedlayout_guide` for an alternative. diff --git a/galleries/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py b/galleries/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py index 07b447c97521..216641657b06 100644 --- a/galleries/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py +++ b/galleries/examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py @@ -1,6 +1,6 @@ """ ================================= -Different scales on the same axes +Different scales on the same Axes ================================= Demo of how to display two scales on the left and right y-axis. diff --git a/galleries/examples/subplots_axes_and_figures/figure_title.py b/galleries/examples/subplots_axes_and_figures/figure_title.py index 118157f0579c..85e5044c4eba 100644 --- a/galleries/examples/subplots_axes_and_figures/figure_title.py +++ b/galleries/examples/subplots_axes_and_figures/figure_title.py @@ -3,7 +3,7 @@ Figure labels: suptitle, supxlabel, supylabel ============================================= -Each axes can have a title (or actually three - one each with *loc* "left", +Each Axes can have a title (or actually three - one each with *loc* "left", "center", and "right"), but is sometimes desirable to give a whole figure (or `.SubFigure`) an overall title, using `.Figure.suptitle`. diff --git a/galleries/examples/subplots_axes_and_figures/ganged_plots.py b/galleries/examples/subplots_axes_and_figures/ganged_plots.py index b32d2aed83d6..e25bb16a15e5 100644 --- a/galleries/examples/subplots_axes_and_figures/ganged_plots.py +++ b/galleries/examples/subplots_axes_and_figures/ganged_plots.py @@ -21,7 +21,7 @@ s3 = s1 * s2 fig, axs = plt.subplots(3, 1, sharex=True) -# Remove vertical space between axes +# Remove vertical space between Axes fig.subplots_adjust(hspace=0) # Plot each graph, and manually set the y tick values diff --git a/galleries/examples/subplots_axes_and_figures/gridspec_and_subplots.py b/galleries/examples/subplots_axes_and_figures/gridspec_and_subplots.py index bff3ea579e9e..0535a7afdde4 100644 --- a/galleries/examples/subplots_axes_and_figures/gridspec_and_subplots.py +++ b/galleries/examples/subplots_axes_and_figures/gridspec_and_subplots.py @@ -3,12 +3,12 @@ Combining two subplots using subplots and GridSpec ================================================== -Sometimes we want to combine two subplots in an axes layout created with -`~.Figure.subplots`. We can get the `~.gridspec.GridSpec` from the axes -and then remove the covered axes and fill the gap with a new bigger axes. -Here we create a layout with the bottom two axes in the last column combined. +Sometimes we want to combine two subplots in an Axes layout created with +`~.Figure.subplots`. We can get the `~.gridspec.GridSpec` from the Axes +and then remove the covered Axes and fill the gap with a new bigger Axes. +Here we create a layout with the bottom two Axes in the last column combined. -To start with this layout (rather than removing the overlapping axes) use +To start with this layout (rather than removing the overlapping Axes) use `~.pyplot.subplot_mosaic`. See also :ref:`arranging_axes`. @@ -18,7 +18,7 @@ fig, axs = plt.subplots(ncols=3, nrows=3) gs = axs[1, 2].get_gridspec() -# remove the underlying axes +# remove the underlying Axes for ax in axs[1:, -1]: ax.remove() axbig = fig.add_subplot(gs[1:, -1]) diff --git a/galleries/examples/subplots_axes_and_figures/multiple_figs_demo.py b/galleries/examples/subplots_axes_and_figures/multiple_figs_demo.py index 9bb9962c8e28..5f3d0660a46d 100644 --- a/galleries/examples/subplots_axes_and_figures/multiple_figs_demo.py +++ b/galleries/examples/subplots_axes_and_figures/multiple_figs_demo.py @@ -3,7 +3,7 @@ Managing multiple figures in pyplot =================================== -`matplotlib.pyplot` uses the concept of a *current figure* and *current axes*. +`matplotlib.pyplot` uses the concept of a *current figure* and *current Axes*. Figures are identified via a figure number that is passed to `~.pyplot.figure`. The figure with the given number is set as *current figure*. Additionally, if no figure with the number exists, a new one is created. diff --git a/galleries/examples/subplots_axes_and_figures/share_axis_lims_views.py b/galleries/examples/subplots_axes_and_figures/share_axis_lims_views.py index 751f7effc6a1..234a15660f2d 100644 --- a/galleries/examples/subplots_axes_and_figures/share_axis_lims_views.py +++ b/galleries/examples/subplots_axes_and_figures/share_axis_lims_views.py @@ -6,7 +6,7 @@ with time as a common axis. When you pan and zoom around on one, you want the other to move around with you. To facilitate this, matplotlib Axes support a ``sharex`` and ``sharey`` attribute. When you create a `~.pyplot.subplot` or -`~.pyplot.axes`, you can pass in a keyword indicating what axes you want to +`~.pyplot.axes`, you can pass in a keyword indicating what Axes you want to share with. """ diff --git a/galleries/examples/subplots_axes_and_figures/shared_axis_demo.py b/galleries/examples/subplots_axes_and_figures/shared_axis_demo.py index cfe2d68701f0..6b3b3839a437 100644 --- a/galleries/examples/subplots_axes_and_figures/shared_axis_demo.py +++ b/galleries/examples/subplots_axes_and_figures/shared_axis_demo.py @@ -6,7 +6,7 @@ You can share the x- or y-axis limits for one axis with another by passing an `~.axes.Axes` instance as a *sharex* or *sharey* keyword argument. -Changing the axis limits on one axes will be reflected automatically +Changing the axis limits on one Axes will be reflected automatically in the other, and vice-versa, so when you navigate with the toolbar the Axes will follow each other on their shared axis. Ditto for changes in the axis scaling (e.g., log vs. linear). However, it is diff --git a/galleries/examples/subplots_axes_and_figures/subfigures.py b/galleries/examples/subplots_axes_and_figures/subfigures.py index 9141ab61abef..6272de975c4d 100644 --- a/galleries/examples/subplots_axes_and_figures/subfigures.py +++ b/galleries/examples/subplots_axes_and_figures/subfigures.py @@ -69,7 +69,7 @@ def example_plot(ax, fontsize=12, hide_labels=False): for a in axs[:, 0]: a.remove() -# plot data in remaining axes: +# plot data in remaining Axes: for a in axs[:, 1:].flat: a.plot(np.arange(10)) diff --git a/galleries/examples/subplots_axes_and_figures/subplots_demo.py b/galleries/examples/subplots_axes_and_figures/subplots_demo.py index 2e2dc3681cde..229ecd34cc9f 100644 --- a/galleries/examples/subplots_axes_and_figures/subplots_demo.py +++ b/galleries/examples/subplots_axes_and_figures/subplots_demo.py @@ -181,7 +181,7 @@ # %% # If you want a more complex sharing structure, you can first create the -# grid of axes with no sharing, and then call `.axes.Axes.sharex` or +# grid of Axes with no sharing, and then call `.axes.Axes.sharex` or # `.axes.Axes.sharey` to add sharing info a posteriori. fig, axs = plt.subplots(2, 2) @@ -197,7 +197,7 @@ fig.tight_layout() # %% -# Polar axes +# Polar Axes # """""""""" # # The parameter *subplot_kw* of `.pyplot.subplots` controls the subplot diff --git a/galleries/examples/subplots_axes_and_figures/two_scales.py b/galleries/examples/subplots_axes_and_figures/two_scales.py index 857c22d5094d..249a65fd64fe 100644 --- a/galleries/examples/subplots_axes_and_figures/two_scales.py +++ b/galleries/examples/subplots_axes_and_figures/two_scales.py @@ -3,14 +3,14 @@ Plots with different scales =========================== -Two plots on the same axes with different left and right scales. +Two plots on the same Axes with different left and right scales. -The trick is to use *two different axes* that share the same *x* axis. +The trick is to use *two different Axes* that share the same *x* axis. You can use separate `matplotlib.ticker` formatters and locators as -desired since the two axes are independent. +desired since the two Axes are independent. -Such axes are generated by calling the `.Axes.twinx` method. Likewise, -`.Axes.twiny` is available to generate axes that share a *y* axis but +Such Axes are generated by calling the `.Axes.twinx` method. Likewise, +`.Axes.twiny` is available to generate Axes that share a *y* axis but have different top and bottom scales. """ import matplotlib.pyplot as plt @@ -29,7 +29,7 @@ ax1.plot(t, data1, color=color) ax1.tick_params(axis='y', labelcolor=color) -ax2 = ax1.twinx() # instantiate a second axes that shares the same x-axis +ax2 = ax1.twinx() # instantiate a second Axes that shares the same x-axis color = 'tab:blue' ax2.set_ylabel('sin', color=color) # we already handled the x-label with ax1 diff --git a/galleries/examples/subplots_axes_and_figures/zoom_inset_axes.py b/galleries/examples/subplots_axes_and_figures/zoom_inset_axes.py index 0d03db15b434..4cbd9875e4bc 100644 --- a/galleries/examples/subplots_axes_and_figures/zoom_inset_axes.py +++ b/galleries/examples/subplots_axes_and_figures/zoom_inset_axes.py @@ -1,9 +1,9 @@ """ ====================== -Zoom region inset axes +Zoom region inset Axes ====================== -Example of an inset axes and a rectangle showing where the zoom is located. +Example of an inset Axes and a rectangle showing where the zoom is located. """ import numpy as np @@ -22,7 +22,7 @@ ax.imshow(Z2, extent=extent, origin="lower") -# inset axes.... +# inset Axes.... x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9 # subregion of the original image axins = ax.inset_axes( [0.5, 0.5, 0.47, 0.47], diff --git a/galleries/examples/text_labels_and_annotations/align_ylabels.py b/galleries/examples/text_labels_and_annotations/align_ylabels.py index 7e6e4152da7f..168f5f6d8c19 100644 --- a/galleries/examples/text_labels_and_annotations/align_ylabels.py +++ b/galleries/examples/text_labels_and_annotations/align_ylabels.py @@ -43,7 +43,7 @@ def make_plot(axs): fig.subplots_adjust(left=0.2, wspace=0.6) make_plot(axs) -# just align the last column of axes: +# just align the last column of Axes: fig.align_ylabels(axs[:, 1]) plt.show() diff --git a/galleries/examples/text_labels_and_annotations/annotation_demo.py b/galleries/examples/text_labels_and_annotations/annotation_demo.py index 8b310a7a1865..99abcdfc7943 100644 --- a/galleries/examples/text_labels_and_annotations/annotation_demo.py +++ b/galleries/examples/text_labels_and_annotations/annotation_demo.py @@ -29,15 +29,15 @@ # 'figure points' : points from the lower left corner of the figure # 'figure pixels' : pixels from the lower left corner of the figure # 'figure fraction' : (0, 0) is lower left of figure and (1, 1) is upper right -# 'axes points' : points from lower left corner of axes -# 'axes pixels' : pixels from lower left corner of axes -# 'axes fraction' : (0, 0) is lower left of axes and (1, 1) is upper right +# 'axes points' : points from lower left corner of the Axes +# 'axes pixels' : pixels from lower left corner of the Axes +# 'axes fraction' : (0, 0) is lower left of Axes and (1, 1) is upper right # 'offset points' : Specify an offset (in points) from the xy value # 'offset pixels' : Specify an offset (in pixels) from the xy value -# 'data' : use the axes data coordinate system +# 'data' : use the Axes data coordinate system # # Note: for physical coordinate systems (points or pixels) the origin is the -# (bottom, left) of the figure or axes. +# (bottom, left) of the figure or Axes. # # Optionally, you can specify arrow properties which draws and arrow # from the text to the annotated point by giving a dictionary of arrow @@ -85,7 +85,7 @@ horizontalalignment='right', verticalalignment='top') # You may also use negative points or pixels to specify from (right, top). -# E.g., (-10, 10) is 10 points to the left of the right side of the axes and 10 +# E.g., (-10, 10) is 10 points to the left of the right side of the Axes and 10 # points above the bottom ax.annotate('pixel offset from axes fraction', @@ -103,10 +103,10 @@ # # You can specify the *xypoint* and the *xytext* in different positions and # coordinate systems, and optionally turn on a connecting line and mark the -# point with a marker. Annotations work on polar axes too. +# point with a marker. Annotations work on polar Axes too. # # In the example below, the *xy* point is in native coordinates (*xycoords* -# defaults to 'data'). For a polar axes, this is in (theta, radius) space. +# defaults to 'data'). For a polar Axes, this is in (theta, radius) space. # The text in the example is placed in the fractional figure coordinate system. # Text keyword arguments like horizontal and vertical alignment are respected. @@ -127,7 +127,7 @@ verticalalignment='bottom') # %% -# You can also use polar notation on a cartesian axes. Here the native +# You can also use polar notation on a cartesian Axes. Here the native # coordinate system ('data') is cartesian, so you need to specify the # xycoords and textcoords as 'polar' if you want to use (theta, radius). @@ -144,7 +144,7 @@ arrowprops=dict(facecolor='black', shrink=0.05), horizontalalignment='left', verticalalignment='bottom', - clip_on=True) # clip to the axes bounding box + clip_on=True) # clip to the Axes bounding box ax.set(xlim=[-20, 20], ylim=[-20, 20]) diff --git a/galleries/examples/text_labels_and_annotations/arrow_demo.py b/galleries/examples/text_labels_and_annotations/arrow_demo.py index 9607818181dc..11c6c3ec0e5d 100644 --- a/galleries/examples/text_labels_and_annotations/arrow_demo.py +++ b/galleries/examples/text_labels_and_annotations/arrow_demo.py @@ -23,7 +23,7 @@ def make_arrow_graph(ax, data, size=4, display='length', shape='right', Parameters ---------- ax - The axes where the graph is drawn. + The Axes where the graph is drawn. data Dict with probabilities for the bases and pair transitions. size diff --git a/galleries/examples/text_labels_and_annotations/demo_text_rotation_mode.py b/galleries/examples/text_labels_and_annotations/demo_text_rotation_mode.py index a571a07edf49..f8f3a108629c 100644 --- a/galleries/examples/text_labels_and_annotations/demo_text_rotation_mode.py +++ b/galleries/examples/text_labels_and_annotations/demo_text_rotation_mode.py @@ -7,7 +7,7 @@ of rotated text. Rotated `.Text`\s are created by passing the parameter ``rotation`` to -the constructor or the axes' method `~.axes.Axes.text`. +the constructor or the Axes' method `~.axes.Axes.text`. The actual positioning depends on the additional parameters ``horizontalalignment``, ``verticalalignment`` and ``rotation_mode``. @@ -45,11 +45,11 @@ def test_rotation_mode(fig, mode): texts = {} - # use a different text alignment in each axes + # use a different text alignment in each Axes for i, va in enumerate(va_list): for j, ha in enumerate(ha_list): ax = axs[i, j] - # prepare axes layout + # prepare Axes layout ax.set(xticks=[], yticks=[]) ax.axvline(0.5, color="skyblue", zorder=0) ax.axhline(0.5, color="skyblue", zorder=0) diff --git a/galleries/examples/text_labels_and_annotations/figlegend_demo.py b/galleries/examples/text_labels_and_annotations/figlegend_demo.py index 9c19418ae261..f6f74b837c10 100644 --- a/galleries/examples/text_labels_and_annotations/figlegend_demo.py +++ b/galleries/examples/text_labels_and_annotations/figlegend_demo.py @@ -30,7 +30,7 @@ plt.show() # %% -# Sometimes we do not want the legend to overlap the axes. If you use +# Sometimes we do not want the legend to overlap the Axes. If you use # *constrained layout* you can specify "outside right upper", and # *constrained layout* will make room for the legend. diff --git a/galleries/examples/text_labels_and_annotations/label_subplots.py b/galleries/examples/text_labels_and_annotations/label_subplots.py index fd66d46a5b52..166c57e69814 100644 --- a/galleries/examples/text_labels_and_annotations/label_subplots.py +++ b/galleries/examples/text_labels_and_annotations/label_subplots.py @@ -6,7 +6,7 @@ Labelling subplots is relatively straightforward, and varies, so Matplotlib does not have a general method for doing this. -Simplest is putting the label inside the axes. Note, here +Simplest is putting the label inside the Axes. Note, here we use `.pyplot.subplot_mosaic`, and use the subplot labels as keys for the subplots, which is a nice convenience. However, the same method works with `.pyplot.subplots` or keys that are @@ -30,7 +30,7 @@ plt.show() # %% -# We may prefer the labels outside the axes, but still aligned +# We may prefer the labels outside the Axes, but still aligned # with each other, in which case we use a slightly different transform: fig, axs = plt.subplot_mosaic([['a)', 'c)'], ['b)', 'c)'], ['d)', 'd)']], diff --git a/galleries/examples/text_labels_and_annotations/line_with_text.py b/galleries/examples/text_labels_and_annotations/line_with_text.py index 389554bd5ae1..22f5580b33ba 100644 --- a/galleries/examples/text_labels_and_annotations/line_with_text.py +++ b/galleries/examples/text_labels_and_annotations/line_with_text.py @@ -28,7 +28,7 @@ def set_figure(self, figure): self.text.set_figure(figure) super().set_figure(figure) - # Override the axes property setter to set Axes on our children as well. + # Override the Axes property setter to set Axes on our children as well. @lines.Line2D.axes.setter def axes(self, new_axes): self.text.axes = new_axes diff --git a/galleries/examples/text_labels_and_annotations/placing_text_boxes.py b/galleries/examples/text_labels_and_annotations/placing_text_boxes.py index f3b07a25e135..7cf49bf6e0bb 100644 --- a/galleries/examples/text_labels_and_annotations/placing_text_boxes.py +++ b/galleries/examples/text_labels_and_annotations/placing_text_boxes.py @@ -2,7 +2,7 @@ Placing text boxes ================== -When decorating axes with text boxes, two useful tricks are to place the text +When decorating Axes with text boxes, two useful tricks are to place the text in axes coordinates (see :ref:`transforms_tutorial`), so the text doesn't move around with changes in x or y limits. You can also use the ``bbox`` property of text to surround the text with a diff --git a/galleries/examples/text_labels_and_annotations/titles_demo.py b/galleries/examples/text_labels_and_annotations/titles_demo.py index 7202ac9115ff..6fc0e350fdb2 100644 --- a/galleries/examples/text_labels_and_annotations/titles_demo.py +++ b/galleries/examples/text_labels_and_annotations/titles_demo.py @@ -4,7 +4,7 @@ ================= Matplotlib can display plot titles centered, flush with the left side of -a set of axes, and flush with the right side of a set of axes. +a set of Axes, and flush with the right side of a set of Axes. """ import matplotlib.pyplot as plt diff --git a/galleries/examples/ticks/colorbar_tick_labelling_demo.py b/galleries/examples/ticks/colorbar_tick_labelling_demo.py index 8a1e5b28043d..6436748a46ec 100644 --- a/galleries/examples/ticks/colorbar_tick_labelling_demo.py +++ b/galleries/examples/ticks/colorbar_tick_labelling_demo.py @@ -6,8 +6,8 @@ Vertical colorbars have ticks, tick labels, and labels visible on the *y* axis, horizontal colorbars on the *x* axis. The ``ticks`` parameter can be used to set the ticks and the ``format`` parameter can be used to format the tick labels -of the visible colorbar axes. For further adjustments, the ``yaxis`` or -``xaxis`` axes of the colorbar can be retrieved using its ``ax`` property. +of the visible colorbar Axes. For further adjustments, the ``yaxis`` or +``xaxis`` Axes of the colorbar can be retrieved using its ``ax`` property. """ import matplotlib.pyplot as plt import numpy as np diff --git a/galleries/examples/ticks/ticklabels_rotation.py b/galleries/examples/ticks/ticklabels_rotation.py index 711a680def62..216b15d2762c 100644 --- a/galleries/examples/ticks/ticklabels_rotation.py +++ b/galleries/examples/ticks/ticklabels_rotation.py @@ -14,7 +14,7 @@ plt.plot(x, y) # You can specify a rotation for the tick labels in degrees or with keywords. plt.xticks(x, labels, rotation='vertical') -# Pad margins so that markers don't get clipped by the axes +# Pad margins so that markers don't get clipped by the Axes plt.margins(0.2) # Tweak spacing to prevent clipping of tick-labels plt.subplots_adjust(bottom=0.15) diff --git a/galleries/examples/user_interfaces/embedding_in_wx4_sgskip.py b/galleries/examples/user_interfaces/embedding_in_wx4_sgskip.py index 56cb5f423980..b9504ff25dee 100644 --- a/galleries/examples/user_interfaces/embedding_in_wx4_sgskip.py +++ b/galleries/examples/user_interfaces/embedding_in_wx4_sgskip.py @@ -28,7 +28,7 @@ def __init__(self, canvas): self.Bind(wx.EVT_TOOL, self._on_custom, id=tool.GetId()) def _on_custom(self, event): - # add some text to the axes in a random location in axes coords with a + # add some text to the Axes in a random location in axes coords with a # random color ax = self.canvas.figure.axes[0] x, y = np.random.rand(2) # generate a random location diff --git a/galleries/examples/user_interfaces/fourier_demo_wx_sgskip.py b/galleries/examples/user_interfaces/fourier_demo_wx_sgskip.py index 56c62ae1ba77..f51917fda6b9 100644 --- a/galleries/examples/user_interfaces/fourier_demo_wx_sgskip.py +++ b/galleries/examples/user_interfaces/fourier_demo_wx_sgskip.py @@ -164,7 +164,7 @@ def mouseMotion(self, event): if self.state == '': return x, y = event.xdata, event.ydata - if x is None: # outside the axes + if x is None: # outside the Axes return x0, y0, f0Init, AInit = self.mouseInfo self.A.set(AInit + (AInit * (y - y0) / y0), self) diff --git a/galleries/examples/widgets/multicursor.py b/galleries/examples/widgets/multicursor.py index 3a80b9ef8230..bc0d58b6c749 100644 --- a/galleries/examples/widgets/multicursor.py +++ b/galleries/examples/widgets/multicursor.py @@ -5,9 +5,9 @@ Showing a cursor on multiple plots simultaneously. -This example generates three axes split over two different figures. On +This example generates three Axes split over two different figures. On hovering the cursor over data in one subplot, the values of that datapoint are -shown in all axes. +shown in all Axes. """ import matplotlib.pyplot as plt diff --git a/galleries/tutorials/artists.py b/galleries/tutorials/artists.py index 46303372d7ae..f5e4589e8a52 100644 --- a/galleries/tutorials/artists.py +++ b/galleries/tutorials/artists.py @@ -286,7 +286,7 @@ class in the Matplotlib API, and the one you will be working with most # :class:`~matplotlib.patches.Rectangle` which is stored in # :attr:`Figure.patch `. As # you add subplots (:meth:`~matplotlib.figure.Figure.add_subplot`) and -# axes (:meth:`~matplotlib.figure.Figure.add_axes`) to the figure +# Axes (:meth:`~matplotlib.figure.Figure.add_axes`) to the figure # these will be appended to the :attr:`Figure.axes # `. These are also returned by the # methods that create them: @@ -443,7 +443,7 @@ class in the Matplotlib API, and the one you will be working with most # # create a rectangle instance # In [263]: rect = matplotlib.patches.Rectangle((1, 1), width=5, height=12) # -# # by default the axes instance is None +# # by default the Axes instance is None # In [264]: print(rect.axes) # None # @@ -454,7 +454,7 @@ class in the Matplotlib API, and the one you will be working with most # # now we add the Rectangle to the Axes # In [266]: ax.add_patch(rect) # -# # and notice that the ax.add_patch method has set the axes +# # and notice that the ax.add_patch method has set the Axes # # instance # In [267]: print(rect.axes) # Axes(0.125,0.1;0.775x0.8) @@ -485,7 +485,7 @@ class in the Matplotlib API, and the one you will be working with most # [ 0. 100. 0.] # [ 0. 0. 1.]]))))))) # -# # the default axes transformation is ax.transData +# # the default Axes transformation is ax.transData # In [269]: print(ax.transData) # CompositeGenericTransform( # TransformWrapper( diff --git a/galleries/tutorials/lifecycle.py b/galleries/tutorials/lifecycle.py index 9df59a5d229f..4aae4d6c1dbc 100644 --- a/galleries/tutorials/lifecycle.py +++ b/galleries/tutorials/lifecycle.py @@ -86,7 +86,7 @@ # # .. note:: # -# Figures can have multiple axes on them. For information on how to do this, +# Figures can have multiple Axes on them. For information on how to do this, # see the :ref:`Tight Layout tutorial # `. @@ -212,7 +212,7 @@ def currency(x, pos): # %% # We can then apply this function to the labels on our plot. To do this, -# we use the ``xaxis`` attribute of our axes. This lets you perform +# we use the ``xaxis`` attribute of our Axes. This lets you perform # actions on a specific axis on our plot. fig, ax = plt.subplots(figsize=(6, 8)) @@ -230,7 +230,7 @@ def currency(x, pos): # # It is possible to draw multiple plot elements on the same instance of # :class:`axes.Axes`. To do this we simply need to call another one of -# the plot methods on that axes object. +# the plot methods on that Axes object. fig, ax = plt.subplots(figsize=(8, 8)) ax.barh(group_names, group_data) diff --git a/galleries/tutorials/pyplot.py b/galleries/tutorials/pyplot.py index 3c9f65a68c57..ee5c228cef32 100644 --- a/galleries/tutorials/pyplot.py +++ b/galleries/tutorials/pyplot.py @@ -26,7 +26,7 @@ # In :mod:`matplotlib.pyplot` various states are preserved # across function calls, so that it keeps track of things like # the current figure and plotting area, and the plotting -# functions are directed to the current axes (please note that "axes" here +# functions are directed to the current Axes (please note that "axes" here # and in most places in the documentation refers to the *axes* # :ref:`part of a figure ` # and not the strict mathematical term for more than one axis). @@ -81,7 +81,7 @@ # list of line styles and format strings. The # `~.pyplot.axis` function in the example above takes a # list of ``[xmin, xmax, ymin, ymax]`` and specifies the viewport of the -# axes. +# Axes. # # If matplotlib were limited to working with lists, it would be fairly # useless for numeric processing. Generally, you will use `numpy @@ -241,12 +241,12 @@ # .. _multiple-figs-axes: # # -# Working with multiple figures and axes +# Working with multiple figures and Axes # ====================================== # # MATLAB, and :mod:`.pyplot`, have the concept of the current figure -# and the current axes. All plotting functions apply to the current -# axes. The function `~.pyplot.gca` returns the current axes (a +# and the current Axes. All plotting functions apply to the current +# Axes. The function `~.pyplot.gca` returns the current Axes (a # `matplotlib.axes.Axes` instance), and `~.pyplot.gcf` returns the current # figure (a `matplotlib.figure.Figure` instance). Normally, you don't have to # worry about this, because it is all taken care of behind the scenes. Below @@ -278,17 +278,17 @@ def f(t): # to ``subplot(2, 1, 1)``. # # You can create an arbitrary number of subplots -# and axes. If you want to place an Axes manually, i.e., not on a +# and Axes. If you want to place an Axes manually, i.e., not on a # rectangular grid, use `~.pyplot.axes`, # which allows you to specify the location as ``axes([left, bottom, # width, height])`` where all values are in fractional (0 to 1) # coordinates. See :doc:`/gallery/subplots_axes_and_figures/axes_demo` for an example of -# placing axes manually and :doc:`/gallery/subplots_axes_and_figures/subplot` for an +# placing Axes manually and :doc:`/gallery/subplots_axes_and_figures/subplot` for an # example with lots of subplots. # # You can create multiple figures by using multiple # `~.pyplot.figure` calls with an increasing figure -# number. Of course, each figure can contain as many axes and subplots +# number. Of course, each figure can contain as many Axes and subplots # as your heart desires:: # # import matplotlib.pyplot as plt @@ -309,8 +309,8 @@ def f(t): # plt.title('Easy as 1, 2, 3') # subplot 211 title # # You can clear the current figure with `~.pyplot.clf` -# and the current axes with `~.pyplot.cla`. If you find -# it annoying that states (specifically the current image, figure and axes) +# and the current Axes with `~.pyplot.cla`. If you find +# it annoying that states (specifically the current image, figure and Axes) # are being maintained for you behind the scenes, don't despair: this is just a thin # stateful wrapper around an object-oriented API, which you can use # instead (see :ref:`artists_tutorial`) diff --git a/galleries/users_explain/artists/color_cycle.py b/galleries/users_explain/artists/color_cycle.py index 715b75a88ff4..a5d789028700 100644 --- a/galleries/users_explain/artists/color_cycle.py +++ b/galleries/users_explain/artists/color_cycle.py @@ -18,8 +18,8 @@ This example demonstrates two different APIs: 1. Setting the rc parameter specifying the default property cycle. - This affects all subsequent axes (but not axes already created). -2. Setting the property cycle for a single pair of axes. + This affects all subsequent Axes (but not Axes already created). +2. Setting the property cycle for a single pair of Axes. """ from cycler import cycler @@ -51,7 +51,7 @@ plt.rc('axes', prop_cycle=default_cycler) # %% -# Now we'll generate a figure with two axes, one on top of the other. On the +# Now we'll generate a figure with two Axes, one on top of the other. On the # first axis, we'll plot with the default cycler. On the second axis, we'll # set the ``prop_cycle`` using :func:`matplotlib.axes.Axes.set_prop_cycle`, # which will only set the ``prop_cycle`` for this :mod:`matplotlib.axes.Axes` diff --git a/galleries/users_explain/artists/imshow_extent.py b/galleries/users_explain/artists/imshow_extent.py index d222af6aee26..d16a15f1e9f9 100644 --- a/galleries/users_explain/artists/imshow_extent.py +++ b/galleries/users_explain/artists/imshow_extent.py @@ -11,7 +11,7 @@ will be used as-is) to a rectangular region in data space. The orientation of the image in the final rendering is controlled by the *origin* and *extent* keyword arguments (and attributes on the resulting `.AxesImage` instance) and -the data limits of the axes. +the data limits of the Axes. The *extent* keyword arguments controls the bounding box in data coordinates that the image will fill specified as ``(left, right, bottom, top)`` in **data @@ -218,9 +218,9 @@ def generate_imshow_demo_grid(extents, xlim=None, ylim=None): # By setting *extent* we define the coordinates of the image area. The # underlying image data is interpolated/resampled to fill that area. # -# If the axes is set to autoscale, then the view limits of the axes are set +# If the Axes is set to autoscale, then the view limits of the Axes are set # to match the *extent* which ensures that the coordinate set by -# ``(left, bottom)`` is at the bottom left of the axes! However, this +# ``(left, bottom)`` is at the bottom left of the Axes! However, this # may invert the axis so they do not increase in the 'natural' direction. # @@ -240,7 +240,7 @@ def generate_imshow_demo_grid(extents, xlim=None, ylim=None): # ------------------------------- # # If we fix the axes limits by explicitly setting `~.axes.Axes.set_xlim` / -# `~.axes.Axes.set_ylim`, we force a certain size and orientation of the axes. +# `~.axes.Axes.set_ylim`, we force a certain size and orientation of the Axes. # This can decouple the 'left-right' and 'top-bottom' sense of the image from # the orientation on the screen. # diff --git a/galleries/users_explain/artists/paths.py b/galleries/users_explain/artists/paths.py index b096d05d0751..669e18107e5c 100644 --- a/galleries/users_explain/artists/paths.py +++ b/galleries/users_explain/artists/paths.py @@ -186,7 +186,7 @@ # verts[3::5, 1] = bottom # # All that remains is to create the path, attach it to a -# :class:`~matplotlib.patches.PathPatch`, and add it to our axes:: +# :class:`~matplotlib.patches.PathPatch`, and add it to our Axes:: # # barpath = path.Path(verts, codes) # patch = patches.PathPatch(barpath, facecolor='green', diff --git a/galleries/users_explain/artists/transforms_tutorial.py b/galleries/users_explain/artists/transforms_tutorial.py index a39cf7a30192..bf99dfd81d2a 100644 --- a/galleries/users_explain/artists/transforms_tutorial.py +++ b/galleries/users_explain/artists/transforms_tutorial.py @@ -32,8 +32,8 @@ +----------------+-----------------------------------+-----------------------------+ |"axes" |The coordinate system of the |``ax.transAxes`` | | |`~matplotlib.axes.Axes`; (0, 0) | | -| |is bottom left of the axes, and | | -| |(1, 1) is top right of the axes. | | +| |is bottom left of the Axes, and | | +| |(1, 1) is top right of the Axes. | | +----------------+-----------------------------------+-----------------------------+ |"subfigure" |The coordinate system of the |``subfigure.transSubfigure`` | | |`.SubFigure`; (0, 0) is bottom left| | @@ -104,7 +104,7 @@ ================ Let's start with the most commonly used coordinate, the *data* coordinate -system. Whenever you add data to the axes, Matplotlib updates the datalimits, +system. Whenever you add data to the Axes, Matplotlib updates the datalimits, most commonly updated with the :meth:`~matplotlib.axes.Axes.set_xlim` and :meth:`~matplotlib.axes.Axes.set_ylim` methods. For example, in the figure below, the data limits stretch from 0 to 10 on the x-axis, and -1 to 1 on the @@ -243,11 +243,11 @@ # # After the *data* coordinate system, *axes* is probably the second most # useful coordinate system. Here the point (0, 0) is the bottom left of -# your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the top +# your Axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the top # right. You can also refer to points outside the range, so (-0.1, 1.1) -# is to the left and above your axes. This coordinate system is extremely -# useful when placing text in your axes, because you often want a text bubble -# in a fixed, location, e.g., the upper left of the axes pane, and have that +# is to the left and above your Axes. This coordinate system is extremely +# useful when placing text in your Axes, because you often want a text bubble +# in a fixed, location, e.g., the upper left of the Axes pane, and have that # location remain fixed when you pan or zoom. Here is a simple example that # creates four panels and labels them 'A', 'B', 'C', 'D' as you often see in # journals. A more sophisticated approach for such labeling is presented at @@ -266,13 +266,13 @@ # this is less useful in my experience than using ``ax.transAxes`` for # placing text. Nonetheless, here is a silly example which plots some # random dots in data space, and overlays a semi-transparent -# :class:`~matplotlib.patches.Circle` centered in the middle of the axes -# with a radius one quarter of the axes -- if your axes does not +# :class:`~matplotlib.patches.Circle` centered in the middle of the Axes +# with a radius one quarter of the Axes -- if your Axes does not # preserve aspect ratio (see :meth:`~matplotlib.axes.Axes.set_aspect`), # this will look like an ellipse. Use the pan/zoom tool to move around, # or manually change the data xlim and ylim, and you will see the data # move, but the circle will remain fixed because it is not in *data* -# coordinates and will always remain at the center of the axes. +# coordinates and will always remain at the center of the Axes. fig, ax = plt.subplots() x, y = 10*np.random.rand(2, 1000) @@ -348,7 +348,7 @@ # interactively, you can see that changing the size of the figure does # not change the offset of the circle from the lower-left corner, # does not change its size, and the circle remains a circle regardless of -# the aspect ratio of the axes. +# the aspect ratio of the Axes. fig, ax = plt.subplots(figsize=(5, 4)) x, y = 10*np.random.rand(2, 1000) @@ -374,7 +374,7 @@ # %% # Another use is putting a patch with a set physical dimension around a -# data point on the axes. Here we add together two transforms. The +# data point on the Axes. Here we add together two transforms. The # first sets the scaling of how large the ellipse should be and the second # sets its position. The ellipse is then placed at the origin, and then # we use the helper transform :class:`~matplotlib.transforms.ScaledTranslation` @@ -497,7 +497,7 @@ # nonlinear projections and scales that happen in polar and logarithmic # plots, from the linear affine transformations that happen when you pan # and zoom. There is an efficiency here, because you can pan and zoom -# in your axes which affects the affine transformation, but you may not +# in your Axes which affects the affine transformation, but you may not # need to compute the potentially expensive nonlinear scales or # projections on simple navigation events. It is also possible to # multiply affine transformation matrices together, and then apply them @@ -512,12 +512,12 @@ # # We've been introduced to the ``transAxes`` instance above in # :ref:`axes-coords`, which maps the (0, 0), (1, 1) corners of the -# axes or subplot bounding box to *display* space, so let's look at +# Axes or subplot bounding box to *display* space, so let's look at # these other two pieces. # # ``self.transLimits`` is the transformation that takes you from # *data* to *axes* coordinates; i.e., it maps your view xlim and ylim -# to the unit space of the axes (and ``transAxes`` then takes that unit +# to the unit space of the Axes (and ``transAxes`` then takes that unit # space to display space). We can see this in action here # # .. sourcecode:: ipython diff --git a/galleries/users_explain/axes/arranging_axes.py b/galleries/users_explain/axes/arranging_axes.py index 8068d3b92ad3..1f910393a9da 100644 --- a/galleries/users_explain/axes/arranging_axes.py +++ b/galleries/users_explain/axes/arranging_axes.py @@ -75,7 +75,7 @@ location: `~matplotlib.figure.Figure.add_axes` - Adds a single axes at a location specified by + Adds a single Axes at a location specified by ``[left, bottom, width, height]`` in fractions of figure width or height. `~matplotlib.pyplot.subplot` or `.Figure.add_subplot` @@ -91,7 +91,7 @@ # %% # -# As a simple example of manually adding an axes a, lets add a 3 inch x 2 inch +# As a simple example of manually adding an Axes *ax*, lets add a 3 inch x 2 inch # Axes to a 4 inch x 3 inch figure. Note that the location of the subplot is # defined as [left, bottom, width, height] in figure-normalized units: @@ -161,7 +161,7 @@ def annotate_axes(ax, text, fontsize=18): # Grids of fixed-aspect ratio Axes # -------------------------------- # -# Fixed-aspect ratio axes are common for images or maps. However, they +# Fixed-aspect ratio Axes are common for images or maps. However, they # present a challenge to layout because two sets of constraints are being # imposed on the size of the Axes - that they fit in the figure and that they # have a set aspect ratio. This leads to large gaps between Axes by default: diff --git a/galleries/users_explain/axes/autoscale.py b/galleries/users_explain/axes/autoscale.py index a9d6b728866c..ba6d054b3143 100644 --- a/galleries/users_explain/axes/autoscale.py +++ b/galleries/users_explain/axes/autoscale.py @@ -7,7 +7,7 @@ =========== The limits on an axis can be set manually (e.g. ``ax.set_xlim(xmin, xmax)``) -or Matplotlib can set them automatically based on the data already on the axes. +or Matplotlib can set them automatically based on the data already on the Axes. There are a number of options to this autoscaling behaviour, discussed below. """ @@ -165,8 +165,8 @@ # ------------------------ # # Autoscale works out of the box for all lines, patches, and images added to -# the axes. One of the artists that it won't work with is a `.Collection`. -# After adding a collection to the axes, one has to manually trigger the +# the Axes. One of the artists that it won't work with is a `.Collection`. +# After adding a collection to the Axes, one has to manually trigger the # `~matplotlib.axes.Axes.autoscale_view()` to recalculate # axes limits. diff --git a/galleries/users_explain/axes/axes_ticks.py b/galleries/users_explain/axes/axes_ticks.py index aaec87c6a239..4f1dc28038de 100644 --- a/galleries/users_explain/axes/axes_ticks.py +++ b/galleries/users_explain/axes/axes_ticks.py @@ -63,7 +63,7 @@ # ======================= # # Manually setting the ticks as above works well for specific final plots, but -# does not adapt as the user interacts with the axes. At a lower level, +# does not adapt as the user interacts with the Axes. At a lower level, # Matplotlib has ``Locators`` that are meant to automatically choose ticks # depending on the current view limits of the axis, and ``Formatters`` that are # meant to format the tick labels automatically. diff --git a/galleries/users_explain/axes/colorbar_placement.py b/galleries/users_explain/axes/colorbar_placement.py index 1e43d4940a98..6c6aa5a01c79 100644 --- a/galleries/users_explain/axes/colorbar_placement.py +++ b/galleries/users_explain/axes/colorbar_placement.py @@ -13,8 +13,8 @@ Automatic placement of colorbars ================================ -The simplest case is just attaching a colorbar to each axes. Note in this -example that the colorbars steal some space from the parent axes. +The simplest case is just attaching a colorbar to each Axes. Note in this +example that the colorbars steal some space from the parent Axes. """ import matplotlib.pyplot as plt import numpy as np @@ -34,7 +34,7 @@ # %% # The first column has the same type of data in both rows, so it may be # desirable to have just one colorbar. We do this by passing `.Figure.colorbar` -# a list of axes with the *ax* kwarg. +# a list of Axes with the *ax* kwarg. fig, axs = plt.subplots(2, 2) cmaps = ['RdBu_r', 'viridis'] @@ -46,7 +46,7 @@ fig.colorbar(pcm, ax=axs[:, col], shrink=0.6) # %% -# The stolen space can lead to axes in the same subplot layout +# The stolen space can lead to Axes in the same subplot layout # being different sizes, which is often undesired if the the # x-axis on each plot is meant to be comparable as in the following: @@ -58,7 +58,7 @@ # %% # This is usually undesired, and can be worked around in various ways, e.g. -# adding a colorbar to the other axes and then removing it. However, the most +# adding a colorbar to the other Axes and then removing it. However, the most # straightforward is to use :ref:`constrained layout `: fig, axs = plt.subplots(2, 1, figsize=(4, 5), sharex=True, layout='constrained') @@ -81,13 +81,13 @@ fig.colorbar(pcm, ax=[axs[2, 1]], location='left') # %% -# Adjusting the spacing between colorbars and parent axes +# Adjusting the spacing between colorbars and parent Axes # ======================================================= # -# The distance a colorbar is from the parent axes can be adjusted with the -# *pad* keyword argument. This is in units of fraction of the parent axes -# width, and the default for a vertical axes is 0.05 (or 0.15 for a horizontal -# axes). +# The distance a colorbar is from the parent Axes can be adjusted with the +# *pad* keyword argument. This is in units of fraction of the parent Axes +# width, and the default for a vertical Axes is 0.05 (or 0.15 for a horizontal +# Axes). fig, axs = plt.subplots(3, 1, layout='constrained', figsize=(5, 5)) for ax, pad in zip(axs, [0.025, 0.05, 0.1]): @@ -97,7 +97,7 @@ # %% # Note that if you do not use constrained layout, the pad command makes the -# parent axes shrink: +# parent Axes shrink: fig, axs = plt.subplots(3, 1, figsize=(5, 5)) for ax, pad in zip(axs, [0.025, 0.05, 0.1]): @@ -110,17 +110,17 @@ # ============================= # # Sometimes the automatic placement provided by ``colorbar`` does not -# give the desired effect. We can manually create an axes and tell -# ``colorbar`` to use that axes by passing the axes to the *cax* keyword +# give the desired effect. We can manually create an Axes and tell +# ``colorbar`` to use that Axes by passing the Axes to the *cax* keyword # argument. # # Using ``inset_axes`` # -------------------- # -# We can manually create any type of axes for the colorbar to use, but an -# `.Axes.inset_axes` is useful because it is a child of the parent axes and can +# We can manually create any type of Axes for the colorbar to use, but an +# `.Axes.inset_axes` is useful because it is a child of the parent Axes and can # be positioned relative to the parent. Here we add a colorbar centered near -# the bottom of the parent axes. +# the bottom of the parent Axes. fig, ax = plt.subplots(layout='constrained', figsize=(4, 4)) pcm = ax.pcolormesh(np.random.randn(20, 20), cmap='viridis') @@ -130,7 +130,7 @@ # %% # `.Axes.inset_axes` can also specify its position in data coordinates -# using the *transform* keyword argument if you want your axes at a +# using the *transform* keyword argument if you want your Axes at a # certain data position on the graph: fig, ax = plt.subplots(layout='constrained', figsize=(4, 4)) @@ -140,11 +140,11 @@ fig.colorbar(pcm, cax=cax, orientation='horizontal') # %% -# Colorbars attached to fixed-aspect-ratio axes +# Colorbars attached to fixed-aspect-ratio Axes # --------------------------------------------- # -# Placing colorbars for axes with a fixed aspect ratio pose a particular -# challenge as the parent axes changes size depending on the data view. +# Placing colorbars for Axes with a fixed aspect ratio pose a particular +# challenge as the parent Axes changes size depending on the data view. fig, axs = plt.subplots(2, 2, layout='constrained') cmaps = ['RdBu_r', 'viridis'] @@ -161,9 +161,9 @@ fig.colorbar(pcm, ax=ax, shrink=0.6) # %% -# We solve this problem using `.Axes.inset_axes` to locate the axes in "axes +# We solve this problem using `.Axes.inset_axes` to locate the Axes in "axes # coordinates" (see :ref:`transforms_tutorial`). Note that if you zoom in on -# the parent axes, and thus change the shape of it, the colorbar will also +# the parent Axes, and thus change the shape of it, the colorbar will also # change position. fig, axs = plt.subplots(2, 2, layout='constrained') @@ -184,7 +184,7 @@ # %% # .. seealso:: # -# :ref:`axes_grid` has methods for manually creating colorbar axes as well: +# :ref:`axes_grid` has methods for manually creating colorbar Axes as well: # # - :ref:`demo-colorbar-with-inset-locator` # - :ref:`demo-colorbar-with-axes-divider` diff --git a/galleries/users_explain/axes/legend_guide.py b/galleries/users_explain/axes/legend_guide.py index 9900b0aa4bdd..8dbe5e953be6 100644 --- a/galleries/users_explain/axes/legend_guide.py +++ b/galleries/users_explain/axes/legend_guide.py @@ -115,8 +115,8 @@ # *loc*. Please see the documentation at :func:`legend` for more details. # # The ``bbox_to_anchor`` keyword gives a great degree of control for manual -# legend placement. For example, if you want your axes legend located at the -# figure's top right-hand corner instead of the axes' corner, simply specify +# legend placement. For example, if you want your Axes legend located at the +# figure's top right-hand corner instead of the Axes' corner, simply specify # the corner's location and the coordinate system of that location:: # # ax.legend(bbox_to_anchor=(1, 1), diff --git a/galleries/users_explain/axes/mosaic.py b/galleries/users_explain/axes/mosaic.py index 88d4562c7af6..d88c027688cb 100644 --- a/galleries/users_explain/axes/mosaic.py +++ b/galleries/users_explain/axes/mosaic.py @@ -13,11 +13,11 @@ more complex layouts, such as Axes that span multiple columns / rows of the layout or leave some areas of the Figure blank, you can use `.gridspec.GridSpec` (see :ref:`arranging_axes`) or -manually place your axes. `.Figure.subplot_mosaic` aims to provide an -interface to visually lay out your axes (as either ASCII art or nested +manually place your Axes. `.Figure.subplot_mosaic` aims to provide an +interface to visually lay out your Axes (as either ASCII art or nested lists) to streamline this process. -This interface naturally supports naming your axes. +This interface naturally supports naming your Axes. `.Figure.subplot_mosaic` returns a dictionary keyed on the labels used to lay out the Figure. By returning data structures with names, it is easier to write plotting code that is independent of the @@ -75,7 +75,7 @@ def identify_axes(ax_dict, fontsize=48): # %% # Using `.Figure.subplot_mosaic` we can produce the same mosaic but give the -# axes semantic names +# Axes semantic names fig = plt.figure(layout="constrained") ax_dict = fig.subplot_mosaic( @@ -103,7 +103,7 @@ def identify_axes(ax_dict, fontsize=48): # String short-hand # ================= # -# By restricting our axes labels to single characters we can +# By restricting our Axes labels to single characters we can # "draw" the Axes we want as "ASCII art". The following diff --git a/galleries/users_explain/axes/tight_layout_guide.py b/galleries/users_explain/axes/tight_layout_guide.py index 42c227b2e360..39201d34948c 100644 --- a/galleries/users_explain/axes/tight_layout_guide.py +++ b/galleries/users_explain/axes/tight_layout_guide.py @@ -21,7 +21,7 @@ Simple Example ============== -In matplotlib, the location of axes (including subplots) are specified in +In matplotlib, the location of Axes (including subplots) are specified in normalized figure coordinates. It can happen that your axis labels or titles (or sometimes even ticklabels) go outside the figure area, and are thus clipped. @@ -49,7 +49,7 @@ def example_plot(ax, fontsize=12): example_plot(ax, fontsize=24) # %% -# To prevent this, the location of axes needs to be adjusted. For +# To prevent this, the location of Axes needs to be adjusted. For # subplots, this can be done manually by adjusting the subplot parameters # using `.Figure.subplots_adjust`. `.Figure.tight_layout` does this # automatically. @@ -65,7 +65,7 @@ def example_plot(ax, fontsize=12): # equivalently, set :rc:`figure.autolayout` to ``True``. # # When you have multiple subplots, often you see labels of different -# axes overlapping each other. +# Axes overlapping each other. plt.close('all') @@ -140,7 +140,7 @@ def example_plot(ax, fontsize=12): # %% # Although not thoroughly tested, it seems to work for subplots with -# aspect != "auto" (e.g., axes with images). +# aspect != "auto" (e.g., Axes with images). arr = np.arange(100).reshape((10, 10)) @@ -156,12 +156,12 @@ def example_plot(ax, fontsize=12): # Caveats # ======= # -# * `~matplotlib.pyplot.tight_layout` considers all artists on the axes by +# * `~matplotlib.pyplot.tight_layout` considers all artists on the Axes by # default. To remove an artist from the layout calculation you can call # `.Artist.set_in_layout`. # # * ``tight_layout`` assumes that the extra space needed for artists is -# independent of the original location of axes. This is often true, but there +# independent of the original location of Axes. This is often true, but there # are rare cases where it is not. # # * ``pad=0`` can clip some texts by a few pixels. This may be a bug or @@ -219,7 +219,7 @@ def example_plot(ax, fontsize=12): # Pre Matplotlib 2.2, legends and annotations were excluded from the bounding # box calculations that decide the layout. Subsequently, these artists were # added to the calculation, but sometimes it is undesirable to include them. -# For instance in this case it might be good to have the axes shrink a bit +# For instance in this case it might be good to have the Axes shrink a bit # to make room for the legend: fig, ax = plt.subplots(figsize=(4, 3)) @@ -266,7 +266,7 @@ def example_plot(ax, fontsize=12): # ======== # # If you create a colorbar with `.Figure.colorbar`, the created colorbar is -# drawn in a Subplot as long as the parent axes is also a Subplot, so +# drawn in a Subplot as long as the parent Axes is also a Subplot, so # `.Figure.tight_layout` will work. plt.close('all') diff --git a/galleries/users_explain/colors/colorbar_only.py b/galleries/users_explain/colors/colorbar_only.py index f9f126533a16..d210d5a1c8ac 100644 --- a/galleries/users_explain/colors/colorbar_only.py +++ b/galleries/users_explain/colors/colorbar_only.py @@ -22,7 +22,7 @@ Here we create a basic continuous colorbar with ticks and labels. The arguments to the `~.Figure.colorbar` call are the `.ScalarMappable` -(constructed using the *norm* and *cmap* arguments), the axes where the +(constructed using the *norm* and *cmap* arguments), the Axes where the colorbar should be drawn, and the colorbar's orientation. For more information see the :mod:`~matplotlib.colorbar` API. diff --git a/galleries/users_explain/customizing.py b/galleries/users_explain/customizing.py index 58eccbcfa960..b0aaee03239e 100644 --- a/galleries/users_explain/customizing.py +++ b/galleries/users_explain/customizing.py @@ -210,7 +210,7 @@ def plotting_function(): # Matplotlib uses :file:`matplotlibrc` configuration files to customize all # kinds of properties, which we call 'rc settings' or 'rc parameters'. You can # control the defaults of almost every property in Matplotlib: figure size and -# DPI, line width, color and style, axes, axis and grid properties, text and +# DPI, line width, color and style, Axes, axis and grid properties, text and # font properties and so on. The :file:`matplotlibrc` is read at startup to # configure Matplotlib. Matplotlib looks for :file:`matplotlibrc` in four # locations, in the following order: diff --git a/galleries/users_explain/quick_start.py b/galleries/users_explain/quick_start.py index 16d0165ec7a6..5a066f19cd7a 100644 --- a/galleries/users_explain/quick_start.py +++ b/galleries/users_explain/quick_start.py @@ -31,8 +31,8 @@ # creating a Figure with an Axes is using `.pyplot.subplots`. We can then use # `.Axes.plot` to draw some data on the Axes: -fig, ax = plt.subplots() # Create a figure containing a single axes. -ax.plot([1, 2, 3, 4], [1, 4, 2, 3]) # Plot some data on the axes. +fig, ax = plt.subplots() # Create a figure containing a single Axes. +ax.plot([1, 2, 3, 4], [1, 4, 2, 3]) # Plot some data on the Axes. # %% # @@ -62,7 +62,7 @@ # fig = plt.figure() # an empty figure with no Axes # fig, ax = plt.subplots() # a figure with a single Axes # fig, axs = plt.subplots(2, 2) # a figure with a 2x2 grid of Axes -# # a figure with one axes on the left, and two on the right: +# # a figure with one Axes on the left, and two on the right: # fig, axs = plt.subplot_mosaic([['left', 'right_top'], # ['left', 'right_bottom']]) # @@ -170,12 +170,12 @@ # Note that even in the OO-style, we use `.pyplot.figure` to create the Figure. fig, ax = plt.subplots(figsize=(5, 2.7), layout='constrained') -ax.plot(x, x, label='linear') # Plot some data on the axes. -ax.plot(x, x**2, label='quadratic') # Plot more data on the axes... +ax.plot(x, x, label='linear') # Plot some data on the Axes. +ax.plot(x, x**2, label='quadratic') # Plot more data on the Axes... ax.plot(x, x**3, label='cubic') # ... and some more. -ax.set_xlabel('x label') # Add an x-label to the axes. -ax.set_ylabel('y label') # Add a y-label to the axes. -ax.set_title("Simple Plot") # Add a title to the axes. +ax.set_xlabel('x label') # Add an x-label to the Axes. +ax.set_ylabel('y label') # Add a y-label to the Axes. +ax.set_title("Simple Plot") # Add a title to the Axes. ax.legend() # Add a legend. # %% @@ -184,7 +184,7 @@ x = np.linspace(0, 2, 100) # Sample data. plt.figure(figsize=(5, 2.7), layout='constrained') -plt.plot(x, x, label='linear') # Plot some data on the (implicit) axes. +plt.plot(x, x, label='linear') # Plot some data on the (implicit) Axes. plt.plot(x, x**2, label='quadratic') # etc. plt.plot(x, x**3, label='cubic') plt.xlabel('x label') diff --git a/galleries/users_explain/text/annotations.py b/galleries/users_explain/text/annotations.py index a28f5419a8ba..89787c4a6336 100644 --- a/galleries/users_explain/text/annotations.py +++ b/galleries/users_explain/text/annotations.py @@ -63,9 +63,9 @@ # 'figure points' points from the lower left corner of the figure # 'figure pixels' pixels from the lower left corner of the figure # 'figure fraction' (0, 0) is lower left of figure and (1, 1) is upper right -# 'axes points' points from lower left corner of axes -# 'axes pixels' pixels from lower left corner of axes -# 'axes fraction' (0, 0) is lower left of axes and (1, 1) is upper right +# 'axes points' points from lower left corner of the Axes +# 'axes pixels' pixels from lower left corner of the Axes +# 'axes fraction' (0, 0) is lower left of Axes and (1, 1) is upper right # 'data' use the axes data coordinate system # ================== ======================================================== # @@ -79,7 +79,7 @@ # ================== ======================================================== # # For physical coordinate systems (points or pixels) the origin is the -# bottom-left of the figure or axes. Points are +# bottom-left of the figure or Axes. Points are # `typographic points `_ # meaning that they are a physical unit measuring 1/72 of an inch. Points and # pixels are discussed in further detail in :ref:`transforms-fig-scale-dpi`. @@ -153,7 +153,7 @@ # ==================== ===================================================== # # In the example below, the *xy* point is in the data coordinate system -# since *xycoords* defaults to 'data'. For a polar axes, this is in +# since *xycoords* defaults to 'data'. For a polar Axes, this is in # (theta, radius) space. The text in this example is placed in the # fractional figure coordinate system. :class:`matplotlib.text.Text` # keyword arguments like *horizontalalignment*, *verticalalignment* and @@ -505,7 +505,7 @@ def custom_box_style(x0, y0, width, height, mutation_size): # # The ellipse in the example below will have width and height # corresponding to 0.1 and 0.4 in data coordinates and will be -# automatically scaled when the view limits of the axes change. +# automatically scaled when the view limits of the Axes change. from matplotlib.patches import Ellipse from mpl_toolkits.axes_grid1.anchored_artists import AnchoredAuxTransformBox @@ -517,7 +517,7 @@ def custom_box_style(x0, y0, width, height, mutation_size): ax.add_artist(box) # %% -# Another method of anchoring an artist relative to a parent axes or anchor +# Another method of anchoring an artist relative to a parent Axes or anchor # point is via the *bbox_to_anchor* argument of `.AnchoredOffsetbox`. This # artist can then be automatically positioned relative to another artist using # `.HPacker` and `.VPacker`: @@ -580,7 +580,7 @@ def custom_box_style(x0, y0, width, height, mutation_size): # %% # Another commonly used `.Transform` instance is ``Axes.transData``. This -# transform is the coordinate system of the data plotted in the axes. In this +# transform is the coordinate system of the data plotted in the Axes. In this # example, it is used to draw an arrow between related data points in two # Axes. We have passed an empty text because in this case, the annotation # connects data points. @@ -712,7 +712,7 @@ def custom_box_style(x0, y0, width, height, mutation_size): # # `.ConnectionPatch` is like an annotation without text. While `~.Axes.annotate` # is sufficient in most situations, `.ConnectionPatch` is useful when you want -# to connect points in different axes. For example, here we connect the point +# to connect points in different Axes. For example, here we connect the point # *xy* in the data coordinates of ``ax1`` to point *xy* in the data coordinates # of ``ax2``: @@ -727,16 +727,16 @@ def custom_box_style(x0, y0, width, height, mutation_size): # %% # Here, we added the `.ConnectionPatch` to the *figure* -# (with `~.Figure.add_artist`) rather than to either axes. This ensures that -# the ConnectionPatch artist is drawn on top of both axes, and is also necessary +# (with `~.Figure.add_artist`) rather than to either Axes. This ensures that +# the ConnectionPatch artist is drawn on top of both Axes, and is also necessary # when using :ref:`constrained_layout ` -# for positioning the axes. +# for positioning the Axes. # # Zoom effect between Axes # ^^^^^^^^^^^^^^^^^^^^^^^^ # # `mpl_toolkits.axes_grid1.inset_locator` defines some patch classes useful for -# interconnecting two axes. +# interconnecting two Axes. # # .. figure:: /gallery/subplots_axes_and_figures/images/sphx_glr_axes_zoom_effect_001.png # :target: /gallery/subplots_axes_and_figures/axes_zoom_effect.html diff --git a/galleries/users_explain/text/text_props.py b/galleries/users_explain/text/text_props.py index 20111f0775f5..c5ae22c02d38 100644 --- a/galleries/users_explain/text/text_props.py +++ b/galleries/users_explain/text/text_props.py @@ -59,8 +59,8 @@ center or right justified. Here is an example which uses the :func:`~matplotlib.pyplot.text` command to show the various alignment possibilities. The use of ``transform=ax.transAxes`` throughout the -code indicates that the coordinates are given relative to the axes -bounding box, with (0, 0) being the lower left of the axes and (1, 1) the +code indicates that the coordinates are given relative to the Axes +bounding box, with (0, 0) being the lower left of the Axes and (1, 1) the upper right. """ diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 2b83a7ae4a73..59f52dddc20d 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -69,7 +69,7 @@ def _stale_figure_callback(self, val): class _AxesStack: """ - Helper class to track axes in a figure. + Helper class to track Axes in a figure. Axes are tracked both in the order in which they have been added (``self._axes`` insertion/iteration order) and in the separate "gca" stack @@ -81,26 +81,26 @@ def __init__(self): self._counter = itertools.count() def as_list(self): - """List the axes that have been added to the figure.""" + """List the Axes that have been added to the figure.""" return [*self._axes] # This relies on dict preserving order. def remove(self, a): - """Remove the axes from the stack.""" + """Remove the given Axes from the stack.""" self._axes.pop(a) def bubble(self, a): - """Move an axes, which must already exist in the stack, to the top.""" + """Move an Axes, which must already exist in the stack, to the top.""" if a not in self._axes: raise ValueError("Axes has not been added yet") self._axes[a] = next(self._counter) def add(self, a): - """Add an axes to the stack, ignoring it if already present.""" + """Add an Axes to the stack, ignoring it if already present.""" if a not in self._axes: self._axes[a] = next(self._counter) def current(self): - """Return the active axes, or None if the stack is empty.""" + """Return the active Axes, or None if the stack is empty.""" return max(self._axes, key=self._axes.__getitem__, default=None) def __getstate__(self):