diff --git a/galleries/examples/event_handling/figure_axes_enter_leave.py b/galleries/examples/event_handling/figure_axes_enter_leave.py index d55fb6e69d6a..0793f2901585 100644 --- a/galleries/examples/event_handling/figure_axes_enter_leave.py +++ b/galleries/examples/event_handling/figure_axes_enter_leave.py @@ -42,7 +42,7 @@ def on_leave_figure(event): fig, axs = plt.subplots(2, 1) -fig.suptitle('mouse hover over figure or axes to trigger events') +fig.suptitle('mouse hover over figure or Axes to trigger events') fig.canvas.mpl_connect('figure_enter_event', on_enter_figure) fig.canvas.mpl_connect('figure_leave_event', on_leave_figure) diff --git a/galleries/examples/subplots_axes_and_figures/subplots_demo.py b/galleries/examples/subplots_axes_and_figures/subplots_demo.py index 2e2dc3681cde..be016c7ea09a 100644 --- a/galleries/examples/subplots_axes_and_figures/subplots_demo.py +++ b/galleries/examples/subplots_axes_and_figures/subplots_demo.py @@ -133,7 +133,7 @@ # same scale when using ``sharey=True``. fig, axs = plt.subplots(3, sharex=True, sharey=True) -fig.suptitle('Sharing both axes') +fig.suptitle('Sharing both Axes') axs[0].plot(x, y ** 2) axs[1].plot(x, 0.3 * y, 'o') axs[2].plot(x, y, '+') @@ -154,7 +154,7 @@ fig = plt.figure() gs = fig.add_gridspec(3, hspace=0) axs = gs.subplots(sharex=True, sharey=True) -fig.suptitle('Sharing both axes') +fig.suptitle('Sharing both Axes') axs[0].plot(x, y ** 2) axs[1].plot(x, 0.3 * y, 'o') axs[2].plot(x, y, '+') diff --git a/lib/matplotlib/_constrained_layout.py b/lib/matplotlib/_constrained_layout.py index 907e7a24976e..f8db87a9b8b3 100644 --- a/lib/matplotlib/_constrained_layout.py +++ b/lib/matplotlib/_constrained_layout.py @@ -1,11 +1,11 @@ """ -Adjust subplot layouts so that there are no overlapping axes or axes -decorations. All axes decorations are dealt with (labels, ticks, titles, +Adjust subplot layouts so that there are no overlapping Axes or Axes +decorations. All Axes decorations are dealt with (labels, ticks, titles, ticklabels) and some dependent artists are also dealt with (colorbar, suptitle). Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec, -so it is possible to have overlapping axes if the gridspecs overlap (i.e. +so it is possible to have overlapping Axes if the gridspecs overlap (i.e. using `~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using ``figure.subplots()`` or ``figure.add_subplots()`` will participate in the layout. Axes manually placed via ``figure.add_axes()`` will not. @@ -33,8 +33,8 @@ is the width or height of each column/row minus the size of the margins. Then the size of the margins for each row and column are determined as the -max width of the decorators on each axes that has decorators in that margin. -For instance, a normal axes would have a left margin that includes the +max width of the decorators on each Axes that has decorators in that margin. +For instance, a normal Axes would have a left margin that includes the left ticklabels, and the ylabel if it exists. The right margin may include a colorbar, the bottom margin the xaxis decorations, and the top margin the title. @@ -73,11 +73,11 @@ def do_constrained_layout(fig, h_pad, w_pad, `.Figure` instance to do the layout in. h_pad, w_pad : float - Padding around the axes elements in figure-normalized units. + Padding around the Axes elements in figure-normalized units. hspace, wspace : float Fraction of the figure to dedicate to space between the - axes. These are evenly spread between the gaps between the axes. + axes. These are evenly spread between the gaps between the Axes. A value of 0.2 for a three-column layout would have a space of 0.1 of the figure width between each column. If h/wspace < h/w_pad, then the pads are used instead. @@ -111,7 +111,7 @@ def do_constrained_layout(fig, h_pad, w_pad, # larger/smaller). This second reposition tends to be much milder, # so doing twice makes things work OK. - # make margins for all the axes and subfigures in the + # make margins for all the Axes and subfigures in the # figure. Add margins for colorbars... make_layout_margins(layoutgrids, fig, renderer, h_pad=h_pad, w_pad=w_pad, hspace=hspace, wspace=wspace) @@ -128,7 +128,7 @@ def do_constrained_layout(fig, h_pad, w_pad, warn_collapsed = ('constrained_layout not applied because ' 'axes sizes collapsed to zero. Try making ' - 'figure larger or axes decorations smaller.') + 'figure larger or Axes decorations smaller.') if check_no_collapsed_axes(layoutgrids, fig): reposition_axes(layoutgrids, fig, renderer, h_pad=h_pad, w_pad=w_pad, hspace=hspace, wspace=wspace) @@ -152,7 +152,7 @@ def make_layoutgrids(fig, layoutgrids, rect=(0, 0, 1, 1)): (Sub)Figures get a layoutgrid so we can have figure margins. - Gridspecs that are attached to axes get a layoutgrid so axes + Gridspecs that are attached to Axes get a layoutgrid so Axes can have margins. """ @@ -182,7 +182,7 @@ def make_layoutgrids(fig, layoutgrids, rect=(0, 0, 1, 1)): for sfig in fig.subfigs: layoutgrids = make_layoutgrids(sfig, layoutgrids) - # for each axes at the local level add its gridspec: + # for each Axes at the local level add its gridspec: for ax in fig._localaxes: gs = ax.get_gridspec() if gs is not None: @@ -239,7 +239,7 @@ def make_layoutgrids_gs(layoutgrids, gs): def check_no_collapsed_axes(layoutgrids, fig): """ - Check that no axes have collapsed to zero size. + Check that no Axes have collapsed to zero size. """ for sfig in fig.subfigs: ok = check_no_collapsed_axes(layoutgrids, sfig) @@ -270,7 +270,7 @@ def compress_fixed_aspect(layoutgrids, fig): extraw = np.zeros(gs.ncols) extrah = np.zeros(gs.nrows) elif _gs != gs: - raise ValueError('Cannot do compressed layout if axes are not' + raise ValueError('Cannot do compressed layout if Axes are not' 'all from the same gridspec') orig = ax.get_position(original=True) actual = ax.get_position(original=False) @@ -282,7 +282,7 @@ def compress_fixed_aspect(layoutgrids, fig): extrah[sub.rowspan] = np.maximum(extrah[sub.rowspan], dh) if gs is None: - raise ValueError('Cannot do compressed layout if no axes ' + raise ValueError('Cannot do compressed layout if no Axes ' 'are part of a gridspec.') w = np.sum(extraw) / 2 layoutgrids[fig].edit_margin_min('left', w) @@ -313,7 +313,7 @@ def get_margin_from_padding(obj, *, w_pad=0, h_pad=0, nrows, ncols = gs.get_geometry() # there are two margins for each direction. The "cb" # margins are for pads and colorbars, the non-"cb" are - # for the axes decorations (labels etc). + # for the Axes decorations (labels etc). margin = {'leftcb': w_pad, 'rightcb': w_pad, 'bottomcb': h_pad, 'topcb': h_pad, 'left': 0, 'right': 0, @@ -335,7 +335,7 @@ def get_margin_from_padding(obj, *, w_pad=0, h_pad=0, def make_layout_margins(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0, hspace=0, wspace=0): """ - For each axes, make a margin between the *pos* layoutbox and the + For each Axes, make a margin between the *pos* layoutbox and the *axes* layoutbox be a minimum size that can accommodate the decorations on the axis. @@ -379,7 +379,7 @@ def make_layout_margins(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0, margin = get_margin_from_padding(ax, w_pad=w_pad, h_pad=h_pad, hspace=hspace, wspace=wspace) pos, bbox = get_pos_and_bbox(ax, renderer) - # the margin is the distance between the bounding box of the axes + # the margin is the distance between the bounding box of the Axes # and its position (plus the padding from above) margin['left'] += pos.x0 - bbox.x0 margin['right'] += bbox.x1 - pos.x1 @@ -388,7 +388,7 @@ def make_layout_margins(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0, margin['top'] += bbox.y1 - pos.y1 # make margin for colorbars. These margins go in the - # padding margin, versus the margin for axes decorators. + # padding margin, versus the margin for Axes decorators. for cbax in ax._colorbars: # note pad is a fraction of the parent width... pad = colorbar_get_pad(layoutgrids, cbax) @@ -493,14 +493,14 @@ def match_submerged_margins(layoutgrids, fig): """ Make the margins that are submerged inside an Axes the same size. - This allows axes that span two columns (or rows) that are offset + This allows Axes that span two columns (or rows) that are offset from one another to have the same size. This gives the proper layout for something like:: fig = plt.figure(constrained_layout=True) axs = fig.subplot_mosaic("AAAB\nCCDD") - Without this routine, the axes D will be wider than C, because the + Without this routine, the Axes D will be wider than C, because the margin width between the two columns in C has no width by default, whereas the margins between the two columns of D are set by the width of the margin between A and B. However, obviously the user would @@ -613,7 +613,7 @@ def get_cb_parent_spans(cbax): def get_pos_and_bbox(ax, renderer): """ - Get the position and the bbox for the axes. + Get the position and the bbox for the Axes. Parameters ---------- @@ -642,7 +642,7 @@ def get_pos_and_bbox(ax, renderer): def reposition_axes(layoutgrids, fig, renderer, *, w_pad=0, h_pad=0, hspace=0, wspace=0): """ - Reposition all the axes based on the new inner bounding box. + Reposition all the Axes based on the new inner bounding box. """ trans_fig_to_subfig = fig.transFigure - fig.transSubfigure for sfig in fig.subfigs: diff --git a/lib/matplotlib/_layoutgrid.py b/lib/matplotlib/_layoutgrid.py index 8bef9283112c..8f81b14765b6 100644 --- a/lib/matplotlib/_layoutgrid.py +++ b/lib/matplotlib/_layoutgrid.py @@ -5,8 +5,8 @@ Each box is defined by left[ncols], right[ncols], bottom[nrows] and top[nrows], and by two editable margins for each side. The main margin gets its value -set by the size of ticklabels, titles, etc on each axes that is in the figure. -The outer margin is the padding around the axes, and space for any +set by the size of ticklabels, titles, etc on each Axes that is in the figure. +The outer margin is the padding around the Axes, and space for any colorbars. The "inner" widths and heights of these boxes are then constrained to be the diff --git a/lib/matplotlib/_tight_layout.py b/lib/matplotlib/_tight_layout.py index e99ba49bd284..548da79fff04 100644 --- a/lib/matplotlib/_tight_layout.py +++ b/lib/matplotlib/_tight_layout.py @@ -1,7 +1,7 @@ """ Routines to adjust subplot params so that subplots are -nicely fit in the figure. In doing so, only axis labels, tick labels, axes -titles and offsetboxes that are anchored to axes are currently considered. +nicely fit in the figure. In doing so, only axis labels, tick labels, Axes +titles and offsetboxes that are anchored to Axes are currently considered. Internally, this module assumes that the margins (left margin, etc.) which are differences between ``Axes.get_tightbbox`` and ``Axes.bbox`` are independent of @@ -22,7 +22,7 @@ def _auto_adjust_subplotpars( ax_bbox_list=None, pad=1.08, h_pad=None, w_pad=None, rect=None): """ Return a dict of subplot parameters to adjust spacing between subplots - or ``None`` if resulting axes would have zero height or width. + or ``None`` if resulting Axes would have zero height or width. Note that this function ignores geometry information of subplot itself, but uses what is given by the *shape* and *subplot_list* parameters. Also, the @@ -91,7 +91,7 @@ def _auto_adjust_subplotpars( fig_width_inch, fig_height_inch = fig.get_size_inches() - # margins can be negative for axes with aspect applied, so use max(, 0) to + # margins can be negative for Axes with aspect applied, so use max(, 0) to # make them nonnegative. if not margin_left: margin_left = max(hspaces[:, 0].max(), 0) + pad_inch/fig_width_inch @@ -119,12 +119,12 @@ def _auto_adjust_subplotpars( if margin_left + margin_right >= 1: _api.warn_external('Tight layout not applied. The left and right ' 'margins cannot be made large enough to ' - 'accommodate all axes decorations.') + 'accommodate all Axes decorations.') return None if margin_bottom + margin_top >= 1: _api.warn_external('Tight layout not applied. The bottom and top ' 'margins cannot be made large enough to ' - 'accommodate all axes decorations.') + 'accommodate all Axes decorations.') return None kwargs = dict(left=margin_left, @@ -138,8 +138,8 @@ def _auto_adjust_subplotpars( h_axes = (1 - margin_right - margin_left - hspace * (cols - 1)) / cols if h_axes < 0: _api.warn_external('Tight layout not applied. tight_layout ' - 'cannot make axes width small enough to ' - 'accommodate all axes decorations') + 'cannot make Axes width small enough to ' + 'accommodate all Axes decorations') return None else: kwargs["wspace"] = hspace / h_axes @@ -148,8 +148,8 @@ def _auto_adjust_subplotpars( v_axes = (1 - margin_top - margin_bottom - vspace * (rows - 1)) / rows if v_axes < 0: _api.warn_external('Tight layout not applied. tight_layout ' - 'cannot make axes height small enough to ' - 'accommodate all axes decorations.') + 'cannot make Axes height small enough to ' + 'accommodate all Axes decorations.') return None else: kwargs["hspace"] = vspace / v_axes @@ -159,9 +159,9 @@ def _auto_adjust_subplotpars( def get_subplotspec_list(axes_list, grid_spec=None): """ - Return a list of subplotspec from the given list of axes. + Return a list of subplotspec from the given list of Axes. - For an instance of axes that does not support subplotspec, None is inserted + For an instance of Axes that does not support subplotspec, None is inserted in the list. If grid_spec is given, None is inserted for those not from the given @@ -201,7 +201,7 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, fig : Figure axes_list : list of Axes subplotspec_list : list of `.SubplotSpec` - The subplotspecs of each axes. + The subplotspecs of each Axes. renderer : renderer pad : float Padding between the figure edge and the edges of subplots, as a @@ -221,7 +221,7 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, None if tight_layout could not be accomplished. """ - # Multiple axes can share same subplotspec (e.g., if using axes_grid1); + # Multiple Axes can share same subplotspec (e.g., if using axes_grid1); # we need to group them together. ss_to_subplots = {ss: [] for ss in subplotspec_list} for ax, ss in zip(axes_list, subplotspec_list): @@ -240,7 +240,7 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, span_pairs = [] for ss in ss_to_subplots: - # The intent here is to support axes from different gridspecs where + # The intent here is to support Axes from different gridspecs where # one's nrows (or ncols) is a multiple of the other (e.g. 2 and 4), # but this doesn't actually work because the computed wspace, in # relative-axes-height, corresponds to different physical spacings for diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index 4a495531d900..fdd7b4c17b15 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -224,10 +224,10 @@ def remove(self): The effect will not be visible until the figure is redrawn, e.g., with `.FigureCanvasBase.draw_idle`. Call `~.axes.Axes.relim` to - update the axes limits if desired. + update the Axes limits if desired. Note: `~.axes.Axes.relim` will not see collections even if the - collection was added to the axes with *autolim* = True. + collection was added to the Axes with *autolim* = True. Note: there is no support for removing the artist's legend entry. """ @@ -299,7 +299,7 @@ def axes(self): def axes(self, new_axes): if (new_axes is not None and self._axes is not None and new_axes != self._axes): - raise ValueError("Can not reset the axes. You are probably " + raise ValueError("Can not reset the Axes. You are probably " "trying to re-use an artist in more than one " "Axes which is not supported") self._axes = new_axes @@ -340,7 +340,7 @@ def get_window_extent(self, renderer=None): Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as - changing the axes limits, the figure size, or the canvas used + changing the Axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly. diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 0fcabac8c7c0..d4bd751ed598 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -460,8 +460,8 @@ def indicate_inset(self, bounds, inset_ax=None, *, transform=None, visibility to True if the automatic choice is not deemed correct. """ - # to make the axes connectors work, we need to apply the aspect to - # the parent axes. + # to make the Axes connectors work, we need to apply the aspect to + # the parent Axes. self.apply_aspect() if transform is None: @@ -5766,7 +5766,7 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None, im.set_data(X) im.set_alpha(alpha) if im.get_clip_path() is None: - # image does not already have clipping set, clip to axes patch + # image does not already have clipping set, clip to Axes patch im.set_clip_path(self.patch) im._scale_norm(norm, vmin, vmax) im.set_url(url) @@ -6503,7 +6503,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None, ret._scale_norm(norm, vmin, vmax) if ret.get_clip_path() is None: - # image does not already have clipping set, clip to axes patch + # image does not already have clipping set, clip to Axes patch ret.set_clip_path(self.patch) ret.sticky_edges.x[:] = [xl, xr] @@ -8455,7 +8455,7 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5, def _get_aspect_ratio(self): """ - Convenience method to calculate the aspect ratio of the axes in + Convenience method to calculate the aspect ratio of the Axes in the display coordinate system. """ figure_size = self.get_figure().get_size_inches() diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 8d29df3b72e8..b7c8077875c9 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1595,7 +1595,7 @@ def set_prop_cycle(self, *args, **kwargs): def get_aspect(self): """ - Return the aspect ratio of the axes scaling. + Return the aspect ratio of the Axes scaling. This is either "auto" or a float giving the ratio of y/x-scale. """ @@ -1603,7 +1603,7 @@ def get_aspect(self): def set_aspect(self, aspect, adjustable=None, anchor=None, share=False): """ - Set the aspect ratio of the axes scaling, i.e. y/x-scale. + Set the aspect ratio of the Axes scaling, i.e. y/x-scale. Parameters ---------- @@ -2056,7 +2056,7 @@ def axis(self, arg=None, /, *, emit=True, **kwargs): Notes ----- - For 3D axes, this method additionally takes *zmin*, *zmax* as + For 3D Axes, this method additionally takes *zmin*, *zmax* as parameters and likewise returns them. """ if isinstance(arg, (str, bool)): @@ -2808,7 +2808,7 @@ def autoscale(self, enable=True, axis='both', tight=None): None leaves the autoscaling state unchanged. axis : {'both', 'x', 'y'}, default: 'both' The axis on which to operate. (For 3D Axes, *axis* can also be set - to 'z', and 'both' refers to all three axes.) + to 'z', and 'both' refers to all three Axes.) tight : bool or None, default: None If True, first set the margins to zero. Then, this argument is forwarded to `~.axes.Axes.autoscale_view` (regardless of diff --git a/lib/matplotlib/axes/_secondary_axes.py b/lib/matplotlib/axes/_secondary_axes.py index f0ab4f3e3be8..60d9cefe01a9 100644 --- a/lib/matplotlib/axes/_secondary_axes.py +++ b/lib/matplotlib/axes/_secondary_axes.py @@ -57,7 +57,7 @@ def __init__(self, parent, orientation, location, functions, **kwargs): def set_alignment(self, align): """ Set if axes spine and labels are drawn at top or bottom (or left/right) - of the axes. + of the Axes. Parameters ---------- @@ -84,7 +84,7 @@ def set_location(self, location): The position to put the secondary axis. Strings can be 'top' or 'bottom' for orientation='x' and 'right' or 'left' for orientation='y'. A float indicates the relative position on the - parent axes to put the new axes, 0.0 being the bottom (or left) + parent Axes to put the new Axes, 0.0 being the bottom (or left) and 1.0 being the top (or right). """ @@ -129,7 +129,7 @@ def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs): def set_functions(self, functions): """ - Set how the secondary axis converts limits from the parent axes. + Set how the secondary axis converts limits from the parent Axes. Parameters ---------- @@ -152,7 +152,7 @@ def set_functions(self, functions): elif functions is None: self._functions = (lambda x: x, lambda x: x) else: - raise ValueError('functions argument of secondary axes ' + raise ValueError('functions argument of secondary Axes ' 'must be a two-tuple of callable functions ' 'with the first function being the transform ' 'and the second being the inverse') @@ -160,12 +160,12 @@ def set_functions(self, functions): def draw(self, renderer): """ - Draw the secondary axes. + Draw the secondary Axes. - Consults the parent axes for its limits and converts them + Consults the parent Axes for its limits and converts them using the converter specified by `~.axes._secondary_axes.set_functions` (or *functions* - parameter when axes initialized.) + parameter when Axes initialized.) """ self._set_lims() # this sets the scale in case the parent has set its scale. @@ -204,7 +204,7 @@ def _set_scale(self): def _set_lims(self): """ Set the limits based on parent limits and the convert method - between the parent and this secondary axes. + between the parent and this secondary Axes. """ if self._orientation == 'x': lims = self._parent.get_xlim() @@ -222,14 +222,14 @@ def _set_lims(self): def set_aspect(self, *args, **kwargs): """ - Secondary axes cannot set the aspect ratio, so calling this just + Secondary Axes cannot set the aspect ratio, so calling this just sets a warning. """ - _api.warn_external("Secondary axes can't set the aspect ratio") + _api.warn_external("Secondary Axes can't set the aspect ratio") def set_color(self, color): """ - Change the color of the secondary axes and all decorators. + Change the color of the secondary Axes and all decorators. Parameters ---------- @@ -254,7 +254,7 @@ def set_color(self, color): The position to put the secondary axis. Strings can be 'top' or 'bottom' for orientation='x' and 'right' or 'left' for orientation='y'. A float indicates the relative position on the - parent axes to put the new axes, 0.0 being the bottom (or left) + parent Axes to put the new Axes, 0.0 being the bottom (or left) and 1.0 being the top (or right). functions : 2-tuple of func, or Transform with an inverse @@ -278,6 +278,6 @@ def set_color(self, color): Other Parameters ---------------- **kwargs : `~matplotlib.axes.Axes` properties. - Other miscellaneous axes parameters. + Other miscellaneous Axes parameters. ''' _docstring.interpd.update(_secax_docstring=_secax_docstring) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index e7f6724c4372..39b211623a00 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -717,7 +717,7 @@ def isDefault_minfmt(self, value): self.minor._formatter_is_default = value def _get_shared_axes(self): - """Return Grouper of shared axes for current axis.""" + """Return Grouper of shared Axes for current axis.""" return self.axes._shared_axes[ self._get_axis_name()].get_siblings(self.axes) @@ -754,7 +754,7 @@ def set_label_coords(self, x, y, transform=None): By default, the x coordinate of the y label and the y coordinate of the x label are determined by the tick label bounding boxes, but this can - lead to poor alignment of multiple labels if there are multiple axes. + lead to poor alignment of multiple labels if there are multiple Axes. You can also specify the coordinate system of the label with the transform. If None, the default coordinate system will be the axes @@ -1234,7 +1234,7 @@ def _set_lim(self, v0, v1, *, emit=True, auto): if emit: self.axes.callbacks.process(f"{name}lim_changed", self.axes) - # Call all of the other axes that are shared with this one + # Call all of the other Axes that are shared with this one for other in self._get_shared_axes(): if other is self.axes: continue diff --git a/lib/matplotlib/backend_tools.py b/lib/matplotlib/backend_tools.py index ac2a20f1ffa9..781089104f23 100644 --- a/lib/matplotlib/backend_tools.py +++ b/lib/matplotlib/backend_tools.py @@ -483,11 +483,11 @@ def add_figure(self, figure): self.home_views[figure] = WeakKeyDictionary() # Define Home self.push_current(figure) - # Make sure we add a home view for new axes as they're added + # Make sure we add a home view for new Axes as they're added figure.add_axobserver(lambda fig: self.update_home_views(fig)) def clear(self, figure): - """Reset the axes stack.""" + """Reset the Axes stack.""" if figure in self.views: self.views[figure].clear() self.positions[figure].clear() @@ -496,9 +496,9 @@ def clear(self, figure): def update_view(self): """ - Update the view limits and position for each axes from the current - stack position. If any axes are present in the figure that aren't in - the current stack position, use the home view limits for those axes and + Update the view limits and position for each Axes from the current + stack position. If any Axes are present in the figure that aren't in + the current stack position, use the home view limits for those Axes and don't update *any* positions. """ @@ -541,7 +541,7 @@ def push_current(self, figure=None): def _axes_pos(self, ax): """ - Return the original and modified positions for the specified axes. + Return the original and modified positions for the specified Axes. Parameters ---------- @@ -559,7 +559,7 @@ def _axes_pos(self, ax): def update_home_views(self, figure=None): """ - Make sure that ``self.home_views`` has an entry for all axes present + Make sure that ``self.home_views`` has an entry for all Axes present in the figure. """ @@ -807,7 +807,7 @@ def _release(self, event): self._cancel_action() return - # detect twinx, twiny axes and avoid double zooming + # detect twinx, twiny Axes and avoid double zooming twinx = any(a.get_shared_x_axes().joined(a, a1) for a1 in done_ax) twiny = any(a.get_shared_y_axes().joined(a, a1) for a1 in done_ax) done_ax.append(a) @@ -828,7 +828,7 @@ def _release(self, event): class ToolPan(ZoomPanBase): - """Pan axes with left mouse, zoom with right.""" + """Pan Axes with left mouse, zoom with right.""" default_keymap = property(lambda self: mpl.rcParams['keymap.pan']) description = 'Pan axes with left mouse, zoom with right' diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index 2aa7874fbdb7..e4453d93d9be 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -696,7 +696,7 @@ def edit_parameters(self): axes = self.canvas.figure.get_axes() if not axes: QtWidgets.QMessageBox.warning( - self.canvas.parent(), "Error", "There are no axes to edit.") + self.canvas.parent(), "Error", "There are no Axes to edit.") return elif len(axes) == 1: ax, = axes @@ -716,7 +716,7 @@ def edit_parameters(self): titles[i] += f" (id: {id(ax):#x})" # Deduplicate titles. item, ok = QtWidgets.QInputDialog.getItem( self.canvas.parent(), - 'Customize', 'Select axes:', titles, 0, False) + 'Customize', 'Select Axes:', titles, 0, False) if not ok: return ax = axes[titles.index(item)] diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 6c92f3795384..f48611d54d35 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -5,8 +5,8 @@ .. note:: Colorbars are typically created through `.Figure.colorbar` or its pyplot wrapper `.pyplot.colorbar`, which internally use `.Colorbar` together with - `.make_axes_gridspec` (for `.GridSpec`-positioned axes) or `.make_axes` (for - non-`.GridSpec`-positioned axes). + `.make_axes_gridspec` (for `.GridSpec`-positioned Axes) or `.make_axes` (for + non-`.GridSpec`-positioned Axes). End-users most likely won't need to directly use this module's API. """ @@ -29,7 +29,7 @@ _docstring.interpd.update( _make_axes_kw_doc=""" location : None or {'left', 'right', 'top', 'bottom'} - The location, relative to the parent axes, where the colorbar axes + The location, relative to the parent Axes, where the colorbar Axes is created. It also determines the *orientation* of the colorbar (colorbars on the left and right are vertical, colorbars at the top and bottom are horizontal). If None, the location will come from the @@ -42,7 +42,7 @@ incompatible values for *location* and *orientation* raises an exception. fraction : float, default: 0.15 - Fraction of original axes to use for colorbar. + Fraction of original Axes to use for colorbar. shrink : float, default: 1.0 Fraction by which to multiply the size of the colorbar. @@ -51,14 +51,14 @@ Ratio of long to short dimensions. pad : float, default: 0.05 if vertical, 0.15 if horizontal - Fraction of original axes between colorbar and new image axes. + Fraction of original Axes between colorbar and new image Axes. anchor : (float, float), optional - The anchor point of the colorbar axes. + The anchor point of the colorbar Axes. Defaults to (0.0, 0.5) if vertical; (0.5, 1.0) if horizontal. panchor : (float, float), or *False*, optional - The anchor point of the colorbar parent axes. If *False*, the parent + The anchor point of the colorbar parent Axes. If *False*, the parent axes' anchor will be unchanged. Defaults to (1.0, 0.5) if vertical; (0.5, 0.0) if horizontal.""", _colormap_kw_doc=""" @@ -145,7 +145,7 @@ def draw(self, renderer): class _ColorbarAxesLocator: """ - Shrink the axes if there are triangular or rectangular extends. + Shrink the Axes if there are triangular or rectangular extends. """ def __init__(self, cbar): self._cbar = cbar @@ -195,7 +195,7 @@ def get_subplotspec(self): @_docstring.interpd class Colorbar: r""" - Draw a colorbar in an existing axes. + Draw a colorbar in an existing Axes. Typically, colorbars are created using `.Figure.colorbar` or `.pyplot.colorbar` and associated with `.ScalarMappable`\s (such as an @@ -535,7 +535,7 @@ def _draw_all(self): self.vmin, self.vmax = self._boundaries[self._inside][[0, -1]] # Compute the X/Y mesh. X, Y = self._mesh() - # draw the extend triangles, and shrink the inner axes to accommodate. + # draw the extend triangles, and shrink the inner Axes to accommodate. # also adds the outline path to self.outline spine: self._do_extends() lower, upper = self.vmin, self.vmax @@ -628,7 +628,7 @@ def _add_solids_patches(self, X, Y, C, mappable): def _do_extends(self, ax=None): """ - Add the extend tri/rectangles on the outside of the axes. + Add the extend tri/rectangles on the outside of the Axes. ax is unused, but required due to the callbacks on xlim/ylim changed """ @@ -785,7 +785,7 @@ def add_lines(self, *args, **kwargs): self.lines = [] self.lines.append(col) - # make a clip path that is just a linewidth bigger than the axes... + # make a clip path that is just a linewidth bigger than the Axes... fac = np.max(linewidths) / 72 xy = np.array([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]) inches = self.ax.get_figure().dpi_scale_trans @@ -1375,7 +1375,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, """ Create an `~.axes.Axes` suitable for a colorbar. - The axes is placed in the figure of the *parents* axes, by resizing and + The Axes is placed in the figure of the *parents* Axes, by resizing and repositioning *parents*. Parameters @@ -1387,7 +1387,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, Returns ------- cax : `~matplotlib.axes.Axes` - The child axes. + The child Axes. kwargs : dict The reduced keyword dictionary to be passed when creating the colorbar instance. @@ -1417,10 +1417,10 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, pad = kwargs.pop('pad', pad0) if not all(fig is ax.get_figure() for ax in parents): - raise ValueError('Unable to create a colorbar axes as not all ' + raise ValueError('Unable to create a colorbar Axes as not all ' 'parents share the same figure.') - # take a bounding box around all of the given axes + # take a bounding box around all of the given Axes parents_bbox = mtransforms.Bbox.union( [ax.get_position(original=True).frozen() for ax in parents]) @@ -1445,7 +1445,7 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, # new axes coordinates shrinking_trans = mtransforms.BboxTransform(parents_bbox, pb1) - # transform each of the axes in parents using the new transform + # transform each of the Axes in parents using the new transform for ax in parents: new_posn = shrinking_trans.transform(ax.get_position(original=True)) new_posn = mtransforms.Bbox(new_posn) @@ -1480,14 +1480,14 @@ def make_axes_gridspec(parent, *, location=None, orientation=None, """ Create an `~.axes.Axes` suitable for a colorbar. - The axes is placed in the figure of the *parent* axes, by resizing and + The Axes is placed in the figure of the *parent* Axes, by resizing and repositioning *parent*. This function is similar to `.make_axes` and mostly compatible with it. Primary differences are - `.make_axes_gridspec` requires the *parent* to have a subplotspec. - - `.make_axes` positions the axes in figure coordinates; + - `.make_axes` positions the Axes in figure coordinates; `.make_axes_gridspec` positions it using a subplotspec. - `.make_axes` updates the position of the parent. `.make_axes_gridspec` replaces the parent gridspec with a new one. @@ -1501,7 +1501,7 @@ def make_axes_gridspec(parent, *, location=None, orientation=None, Returns ------- cax : `~matplotlib.axes.Axes` - The child axes. + The child Axes. kwargs : dict The reduced keyword dictionary to be passed when creating the colorbar instance. diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index dc5ed5d626bc..fe2512a53307 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -146,7 +146,7 @@ def clabel(self, levels=None, *, use_clabeltext : bool, default: False If ``True``, use `.Text.set_transform_rotates_text` to ensure that - label rotation is updated whenever the axes aspect changes. + label rotation is updated whenever the Axes aspect changes. zorder : float or None, default: ``(2 + contour.get_zorder())`` zorder of the contour labels. @@ -1061,7 +1061,7 @@ def _process_args(self, *args, **kwargs): """ Process *args* and *kwargs*; override in derived classes. - Must set self.levels, self.zmin and self.zmax, and update axes limits. + Must set self.levels, self.zmin and self.zmax, and update Axes limits. """ self.levels = args[0] allsegs = args[1] diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 2b83a7ae4a73..9c00d5c77588 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 @@ -77,30 +77,30 @@ class _AxesStack: """ def __init__(self): - self._axes = {} # Mapping of axes to "gca" order. + self._axes = {} # Mapping of Axes to "gca" order. 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 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): @@ -137,7 +137,7 @@ def __init__(self, **kwargs): # axis._get_tick_boxes_siblings self._align_label_groups = {"x": cbook.Grouper(), "y": cbook.Grouper()} - self._localaxes = [] # track all axes + self._localaxes = [] # track all Axes self.artists = [] self.lines = [] self.patches = [] @@ -508,7 +508,7 @@ def add_axes(self, *args, **kwargs): sharex, sharey : `~matplotlib.axes.Axes`, optional Share the x or y `~matplotlib.axis` with sharex and/or sharey. The axis will have the same limits, ticks, and scale as the axis - of the shared axes. + of the shared Axes. label : str A label for the returned Axes. @@ -516,7 +516,7 @@ def add_axes(self, *args, **kwargs): Returns ------- `~.axes.Axes`, or a subclass of `~.axes.Axes` - The returned axes class depends on the projection used. It is + The returned Axes class depends on the projection used. It is `~.axes.Axes` if rectilinear projection is used and `.projections.polar.PolarAxes` if polar projection is used. @@ -581,7 +581,7 @@ def add_axes(self, *args, **kwargs): raise ValueError(f'all entries in rect must be finite not {rect}') projection_class, pkw = self._process_projection_requirements(**kwargs) - # create the new axes using the axes class given + # create the new Axes using the Axes class given a = projection_class(self, rect, **pkw) key = (projection_class, pkw) @@ -644,7 +644,7 @@ def add_subplot(self, *args, **kwargs): sharex, sharey : `~matplotlib.axes.Axes`, optional Share the x or y `~matplotlib.axis` with sharex and/or sharey. The axis will have the same limits, ticks, and scale as the axis - of the shared axes. + of the shared Axes. label : str A label for the returned Axes. @@ -877,14 +877,14 @@ def delaxes(self, ax): def _remove_axes(self, ax, owners): """ - Common helper for removal of standard axes (via delaxes) and of child axes. + Common helper for removal of standard Axes (via delaxes) and of child Axes. Parameters ---------- ax : `~.AxesBase` The Axes to remove. owners - List of objects (list or _AxesStack) "owning" the axes, from which the Axes + List of objects (list or _AxesStack) "owning" the Axes, from which the Axes will be remove()d. """ for owner in owners: @@ -894,7 +894,7 @@ def _remove_axes(self, ax, owners): self.stale = True self.canvas.release_mouse(ax) - for name in ax._axis_names: # Break link between any shared axes + for name in ax._axis_names: # Break link between any shared Axes grouper = ax._shared_axes[name] siblings = [other for other in grouper.get_siblings(ax) if other is not ax] if not siblings: # Axes was not shared along this axis; we're done. @@ -909,7 +909,7 @@ def _remove_axes(self, ax, owners): remaining_axis.get_minor_formatter().set_axis(remaining_axis) remaining_axis.get_minor_locator().set_axis(remaining_axis) - ax._twinned_axes.remove(ax) # Break link between any twinned axes. + ax._twinned_axes.remove(ax) # Break link between any twinned Axes. def clear(self, keep_observers=False): """ @@ -923,7 +923,7 @@ def clear(self, keep_observers=False): """ self.suppressComposite = None - # first clear the axes in any subfigures + # first clear the Axes in any subfigures for subfig in self.subfigs: subfig.clear(keep_observers=keep_observers) self.subfigs = [] @@ -1192,12 +1192,12 @@ def colorbar( included automatically. The *shrink* kwarg provides a simple way to scale the colorbar with - respect to the axes. Note that if *cax* is specified, it determines the + respect to the Axes. Note that if *cax* is specified, it determines the size of the colorbar, and *shrink* and *aspect* are ignored. For more precise control, you can manually specify the positions of the axes objects in which the mappable and the colorbar are drawn. In this - case, do not use any of the axes properties kwargs. + case, do not use any of the Axes properties kwargs. It is known that some vector graphics viewers (svg and pdf) render white gaps between segments of the colorbar. This is due to bugs in @@ -1224,7 +1224,7 @@ def colorbar( 'Either provide the *cax* argument to use as the Axes for ' 'the Colorbar, provide the *ax* argument to steal space ' 'from it, or add *mappable* to an Axes.') - fig = ( # Figure of first axes; logic copied from make_axes. + fig = ( # Figure of first Axes; logic copied from make_axes. [*ax.flat] if isinstance(ax, np.ndarray) else [*ax] if np.iterable(ax) else [ax])[0].figure @@ -1339,9 +1339,9 @@ def align_xlabels(self, axs=None): _log.debug(' Working on: %s', ax.get_xlabel()) rowspan = ax.get_subplotspec().rowspan pos = ax.xaxis.get_label_position() # top or bottom - # Search through other axes for label positions that are same as + # Search through other Axes for label positions that are same as # this one and that share the appropriate row number. - # Add to a grouper associated with each axes of siblings. + # Add to a grouper associated with each Axes of siblings. # This list is inspected in `axis.draw` by # `axis._update_label_position`. for axc in axs: @@ -1399,9 +1399,9 @@ def align_ylabels(self, axs=None): _log.debug(' Working on: %s', ax.get_ylabel()) colspan = ax.get_subplotspec().colspan pos = ax.yaxis.get_label_position() # left or right - # Search through other axes for label positions that are same as + # Search through other Axes for label positions that are same as # this one and that share the appropriate column number. - # Add to a list associated with each axes of siblings. + # Add to a list associated with each Axes of siblings. # This list is inspected in `axis.draw` by # `axis._update_label_position`. for axc in axs: @@ -1723,7 +1723,7 @@ def get_tightbbox(self, renderer=None, bbox_extra_artists=None): for ax in self.axes: if ax.get_visible(): - # some axes don't take the bbox_extra_artists kwarg so we + # some Axes don't take the bbox_extra_artists kwarg so we # need this conditional.... try: bbox = ax.get_tightbbox( @@ -1882,7 +1882,7 @@ def subplot_mosaic(self, mosaic, *, sharex=False, sharey=False, ------- dict[label, Axes] A dictionary mapping the labels to the Axes objects. The order of - the axes is left-to-right and top-to-bottom of their position in the + the Axes is left-to-right and top-to-bottom of their position in the total layout. """ @@ -1992,7 +1992,7 @@ def _do_layout(gs, mosaic, unique_ids, nested): """ output = dict() - # we need to merge together the Axes at this level and the axes + # we need to merge together the Axes at this level and the Axes # in the (recursively) nested sub-mosaics so that we can add # them to the figure in the "natural" order if you were to # ravel in c-order all of the Axes that will be created @@ -2032,7 +2032,7 @@ def _do_layout(gs, mosaic, unique_ids, nested): # element is an Axes or a nested mosaic. if method == 'axes': slc = arg - # add a single axes + # add a single Axes if name in output: raise ValueError(f"There are duplicate keys {name} " f"in the layout\n{mosaic!r}") @@ -2407,15 +2407,15 @@ def __init__(self, overlapping Axes decorations (labels, ticks, etc). Note that layout managers can have significant performance penalties. - - 'constrained': The constrained layout solver adjusts axes sizes - to avoid overlapping axes decorations. Can handle complex plot + - 'constrained': The constrained layout solver adjusts Axes sizes + to avoid overlapping Axes decorations. Can handle complex plot layouts and colorbars, and is thus recommended. See :ref:`constrainedlayout_guide` for examples. - 'compressed': uses the same algorithm as 'constrained', but removes extra space between fixed-aspect-ratio Axes. Best for - simple grids of axes. + simple grids of Axes. - 'tight': Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the subplot parameters so that @@ -2531,7 +2531,7 @@ def __init__(self, self.subplotpars = subplotpars - self._axstack = _AxesStack() # track all figure axes and current axes + self._axstack = _AxesStack() # track all figure Axes and current Axes self.clear() def pick(self, mouseevent): @@ -2900,7 +2900,7 @@ def figimage(self, X, xo=0, yo=0, alpha=None, norm=None, cmap=None, origin : {'upper', 'lower'}, default: :rc:`image.origin` Indicates where the [0, 0] index of the array is in the upper left - or lower left corner of the axes. + or lower left corner of the Axes. resize : bool If *True*, resize the figure to match the given image size. @@ -3333,7 +3333,7 @@ def _recursively_make_axes_transparent(exit_stack, ax): # set subfigure to appear transparent in printed image for subfig in self.subfigs: _recursively_make_subfig_transparent(stack, subfig) - # set axes to be transparent + # set Axes to be transparent for ax in self.axes: _recursively_make_axes_transparent(stack, ax) self.canvas.print_figure(fname, **kwargs) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 3579bf57176f..b504fc6a5a8e 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -350,7 +350,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0, If *round_to_pixel_border* is True, the output image size will be rounded to the nearest pixel boundary. This makes the images align - correctly with the axes. It should not be used if exact scaling is + correctly with the Axes. It should not be used if exact scaling is needed, such as for `FigureImage`. Returns @@ -403,7 +403,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0, .translate(-clipped_bbox.x0, -clipped_bbox.y0) .scale(magnification))) - # So that the image is aligned with the edge of the axes, we want to + # So that the image is aligned with the edge of the Axes, we want to # round up the output width to the next integer. This also means # scaling the transform slightly to account for the extra subpixel. if ((not unsampled) and t.is_affine and round_to_pixel_border and @@ -854,7 +854,7 @@ class AxesImage(_ImageBase): Parameters ---------- ax : `~matplotlib.axes.Axes` - The axes the image will belong to. + The Axes the image will belong to. cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap` The Colormap instance or registered colormap name used to map scalar data to colors. @@ -872,7 +872,7 @@ class AxesImage(_ImageBase): applied (visual interpolation). origin : {'upper', 'lower'}, default: :rc:`image.origin` Place the [0, 0] index of the array in the upper left or lower left - corner of the axes. The convention 'upper' is typically used for + corner of the Axes. The convention 'upper' is typically used for matrices and images. extent : tuple, optional The data axes (left, right, bottom, top) for making image plots @@ -956,8 +956,8 @@ def set_extent(self, extent, **kwargs): ``(left, right, bottom, top)`` in data coordinates. **kwargs Other parameters from which unit info (i.e., the *xunits*, - *yunits*, *zunits* (for 3D axes), *runits* and *thetaunits* (for - polar axes) entries are applied, if present. + *yunits*, *zunits* (for 3D Axes), *runits* and *thetaunits* (for + polar Axes) entries are applied, if present. Notes ----- @@ -1041,7 +1041,7 @@ def __init__(self, ax, *, interpolation='nearest', **kwargs): Parameters ---------- ax : `~matplotlib.axes.Axes` - The axes the image will belong to. + The Axes the image will belong to. interpolation : {'nearest', 'bilinear'}, default: 'nearest' The interpolation scheme used in the resampling. **kwargs @@ -1208,7 +1208,7 @@ def __init__(self, ax, Parameters ---------- ax : `~matplotlib.axes.Axes` - The axes the image will belong to. + The Axes the image will belong to. x, y : 1D array-like, optional Monotonic arrays of length N+1 and M+1, respectively, specifying rectangle boundaries. If not given, will default to @@ -1566,7 +1566,7 @@ def imsave(fname, arr, vmin=None, vmax=None, cmap=None, format=None, is unset is documented under *fname*. origin : {'upper', 'lower'}, default: :rc:`image.origin` Indicates whether the ``(0, 0)`` index of the array is in the upper - left or lower left corner of the axes. + left or lower left corner of the Axes. dpi : float The DPI to store in the metadata of the file. This does not affect the resolution of the output image. Depending on file format, this may be diff --git a/lib/matplotlib/layout_engine.py b/lib/matplotlib/layout_engine.py index d751059f4e09..5a96745d0697 100644 --- a/lib/matplotlib/layout_engine.py +++ b/lib/matplotlib/layout_engine.py @@ -165,8 +165,8 @@ def execute(self, fig): Execute tight_layout. This decides the subplot parameters given the padding that - will allow the axes labels to not be covered by other labels - and axes. + will allow the Axes labels to not be covered by other labels + and Axes. Parameters ---------- @@ -226,12 +226,12 @@ def __init__(self, *, h_pad=None, w_pad=None, Parameters ---------- h_pad, w_pad : float - Padding around the axes elements in inches. + Padding around the Axes elements in inches. Default to :rc:`figure.constrained_layout.h_pad` and :rc:`figure.constrained_layout.w_pad`. hspace, wspace : float Fraction of the figure to dedicate to space between the - axes. These are evenly spread between the gaps between the axes. + axes. These are evenly spread between the gaps between the Axes. A value of 0.2 for a three-column layout would have a space of 0.1 of the figure width between each column. If h/wspace < h/w_pad, then the pads are used instead. @@ -259,7 +259,7 @@ def __init__(self, *, h_pad=None, w_pad=None, def execute(self, fig): """ - Perform constrained_layout and move and resize axes accordingly. + Perform constrained_layout and move and resize Axes accordingly. Parameters ---------- @@ -284,12 +284,12 @@ def set(self, *, h_pad=None, w_pad=None, Parameters ---------- h_pad, w_pad : float - Padding around the axes elements in inches. + Padding around the Axes elements in inches. Default to :rc:`figure.constrained_layout.h_pad` and :rc:`figure.constrained_layout.w_pad`. hspace, wspace : float Fraction of the figure to dedicate to space between the - axes. These are evenly spread between the gaps between the axes. + axes. These are evenly spread between the gaps between the Axes. A value of 0.2 for a three-column layout would have a space of 0.1 of the figure width between each column. If h/wspace < h/w_pad, then the pads are used instead. diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 58e5dfcfe3b8..754838a28014 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -1,6 +1,6 @@ """ The legend module defines the Legend class, which is responsible for -drawing legends associated with axes and/or figures. +drawing legends associated with Axes and/or figures. .. important:: @@ -12,7 +12,7 @@ The `Legend` class is a container of legend handles and legend texts. The legend handler map specifies how to create legend handles from artists -(lines, patches, etc.) in the axes or figures. Default legend handlers are +(lines, patches, etc.) in the Axes or figures. Default legend handlers are defined in the :mod:`~matplotlib.legend_handler` module. While not all artist types are covered by the default legend handlers, custom legend handlers can be defined to support arbitrary objects. @@ -109,13 +109,13 @@ def _update_bbox_to_anchor(self, loc_in_canvas): If a 4-tuple or `.BboxBase` is given, then it specifies the bbox ``(x, y, width, height)`` that the legend is placed in. To put the legend in the best location in the bottom right - quadrant of the axes (or figure):: + quadrant of the Axes (or figure):: loc='best', bbox_to_anchor=(0.5, 0., 0.5, 0.5) A 2-tuple ``(x, y)`` places the corner of the legend specified by *loc* at x, y. For example, to put the legend's upper right-hand corner in the - center of the axes (or figure) the following keywords can be used:: + center of the Axes (or figure) the following keywords can be used:: loc='upper right', bbox_to_anchor=(0.5, 0.5) @@ -198,7 +198,7 @@ def _update_bbox_to_anchor(self, loc_in_canvas): mode : {"expand", None} If *mode* is set to ``"expand"`` the legend will be horizontally - expanded to fill the axes area (or *bbox_to_anchor* if defines + expanded to fill the Axes area (or *bbox_to_anchor* if defines the legend's size). bbox_transform : None or `~matplotlib.transforms.Transform` @@ -241,7 +241,7 @@ def _update_bbox_to_anchor(self, loc_in_canvas): The pad between the legend handle and text, in font-size units. borderaxespad : float, default: :rc:`legend.borderaxespad` - The pad between the axes and legend border, in font-size units. + The pad between the Axes and legend border, in font-size units. columnspacing : float, default: :rc:`legend.columnspacing` The spacing between columns, in font-size units. @@ -344,7 +344,7 @@ class Legend(Artist): Place a legend on the figure/axes. """ - # 'best' is only implemented for axes legends + # 'best' is only implemented for Axes legends codes = {'best': 0, **AnchoredOffsetbox.codes} zorder = 5 @@ -372,7 +372,7 @@ def __init__( handlelength=None, # length of the legend handles handleheight=None, # height of the legend handles handletextpad=None, # pad between the legend handle and text - borderaxespad=None, # pad between the axes and legend border + borderaxespad=None, # pad between the Axes and legend border columnspacing=None, # spacing between columns ncols=1, # number of columns @@ -638,7 +638,7 @@ def __init__( def _set_artist_props(self, a): """ - Set the boilerplate props for artists added to axes. + Set the boilerplate props for artists added to Axes. """ a.set_figure(self.figure) if self.isaxes: @@ -1248,7 +1248,7 @@ def _get_legend_handles(axs, legend_handler_map=None): *(a for a in ax._children if isinstance(a, (Line2D, Patch, Collection, Text))), *ax.containers] - # support parasite axes: + # support parasite Axes: if hasattr(ax, 'parasites'): for axx in ax.parasites: handles_original += [ diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 31b931a52c82..f82eb88e6aae 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -168,7 +168,7 @@ def _slice_or_none(in_v, slc): f'markevery={markevery}') if ax is None: raise ValueError( - "markevery is specified relative to the axes size, but " + "markevery is specified relative to the Axes size, but " "the line does not have a Axes as parent") # calc cumulative distance along path (in display coords): @@ -180,7 +180,7 @@ def _slice_or_none(in_v, slc): delta[0, :] = 0 delta[1:, :] = disp_coords[1:, :] - disp_coords[:-1, :] delta = np.hypot(*delta.T).cumsum() - # calc distance between markers along path based on the axes + # calc distance between markers along path based on the Axes # bounding box diagonal being a distance of unity: (x0, y0), (x1, y1) = ax.transAxes.transform([[0, 0], [1, 1]]) scale = np.hypot(x1 - x0, y1 - y0) @@ -575,7 +575,7 @@ def set_markevery(self, every): - ``every=0.1``, (i.e. a float): markers will be spaced at approximately equal visual distances along the line; the distance along the line between markers is determined by multiplying the - display-coordinate distance of the axes bounding-box diagonal + display-coordinate distance of the Axes bounding-box diagonal by the value of *every*. - ``every=(0.5, 0.1)`` (i.e. a length-2 tuple of float): similar to ``every=0.1`` but the first marker will be offset along the diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index acf93f5a34d9..935b5b0f657b 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -877,7 +877,7 @@ class AnchoredOffsetbox(OffsetBox): AnchoredOffsetbox has a single child. When multiple children are needed, use an extra OffsetBox to enclose them. By default, the offset box is - anchored against its parent axes. You may explicitly specify the + anchored against its parent Axes. You may explicitly specify the *bbox_to_anchor*. """ zorder = 5 # zorder of the legend @@ -1230,13 +1230,13 @@ def __init__(self, offsetbox, xy, xybox=None, xycoords='data', boxcoords=None, * annotation_clip: bool or None, default: None Whether to clip (i.e. not draw) the annotation when the annotation - point *xy* is outside the axes area. + point *xy* is outside the Axes area. - If *True*, the annotation will be clipped when *xy* is outside - the axes. + the Axes. - If *False*, the annotation will always be drawn. - If *None*, the annotation will be clipped when *xy* is outside - the axes and *xycoords* is 'data'. + the Axes and *xycoords* is 'data'. pad : float, default: 0.4 Padding around the offsetbox. diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index f80df92c62fc..60b7dbd18547 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -161,7 +161,7 @@ def contains_point(self, point, radius=None): point : (float, float) The point (x, y) to check, in target coordinates of ``self.get_transform()``. These are display coordinates for patches - that are added to a figure or axes. + that are added to a figure or Axes. radius : float, optional Additional margin on the patch in target coordinates of ``self.get_transform()``. See `.Path.contains_point` for further @@ -211,7 +211,7 @@ def contains_points(self, points, radius=None): points : (N, 2) array The points to check, in target coordinates of ``self.get_transform()``. These are display coordinates for patches - that are added to a figure or axes. Columns contain x and y values. + that are added to a figure or Axes. Columns contain x and y values. radius : float, optional Additional margin on the patch in target coordinates of ``self.get_transform()``. See `.Path.contains_point` for further @@ -2085,7 +2085,7 @@ def segment_circle_intersect(x0, y0, x1, y1): & (y0e - epsilon < ys) & (ys < y1e + epsilon) ] - # Transform the axes (or figure) box_path so that it is relative to + # Transform the Axes (or figure) box_path so that it is relative to # the unit circle in the same way that it is relative to the desired # ellipse. box_path_transform = ( @@ -4392,7 +4392,7 @@ def draw(self, renderer): class ConnectionPatch(FancyArrowPatch): - """A patch that connects two points (possibly in different axes).""" + """A patch that connects two points (possibly in different Axes).""" def __str__(self): return "ConnectionPatch((%g, %g), (%g, %g))" % \ @@ -4444,15 +4444,15 @@ def __init__(self, xyA, xyB, coordsA, coordsB=None, *, 'subfigure points' points from the lower left corner of the subfigure 'subfigure pixels' pixels from the lower left corner of the subfigure 'subfigure fraction' fraction of the subfigure, 0, 0 is lower left. - '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 coordinate system of the object being annotated (default) 'offset points' offset (in points) from the *xy* value 'polar' you can specify *theta*, *r* for the annotation, even in cartesian plots. Note that if you are - using a polar axes, you do not need to specify + using a polar Axes, you do not need to specify polar for the coordinate system since that is the native "data" coordinate system. ==================== ================================================== @@ -4499,7 +4499,7 @@ def __init__(self, xyA, xyB, coordsA, coordsB=None, *, mutation_aspect=mutation_aspect, clip_on=clip_on, **kwargs) - # if True, draw annotation only if self.xy is inside the axes + # if True, draw annotation only if self.xy is inside the Axes self._annotation_clip = None def _get_xy(self, xy, s, axes=None): @@ -4549,7 +4549,7 @@ def _get_xy(self, xy, s, axes=None): y = bb.y0 + y if y >= 0 else bb.y1 + y return x, y elif s == 'axes pixels': - # pixels from the lower left corner of the axes + # pixels from the lower left corner of the Axes bb = axes.bbox x = bb.x0 + x if x >= 0 else bb.x1 + x y = bb.y0 + y if y >= 0 else bb.y1 + y @@ -4567,10 +4567,10 @@ def set_annotation_clip(self, b): ---------- b : bool or None - True: The annotation will be clipped when ``self.xy`` is - outside the axes. + outside the Axes. - False: The annotation will always be drawn. - None: The annotation will be clipped when ``self.xy`` is - outside the axes and ``self.xycoords == "data"``. + outside the Axes and ``self.xycoords == "data"``. """ self._annotation_clip = b self.stale = True diff --git a/lib/matplotlib/projections/__init__.py b/lib/matplotlib/projections/__init__.py index 16a5651da1d1..7fef1fbff5d2 100644 --- a/lib/matplotlib/projections/__init__.py +++ b/lib/matplotlib/projections/__init__.py @@ -14,9 +14,9 @@ has a facility to help with doing so. - Setting up default values (overriding `~.axes.Axes.cla`), since the defaults - for a rectilinear axes may not be appropriate. + for a rectilinear Axes may not be appropriate. -- Defining the shape of the axes, for example, an elliptical axes, that will be +- Defining the shape of the Axes, for example, an elliptical Axes, that will be used to draw the background of the plot and for clipping any data elements. - Defining custom locators and formatters for the projection. For example, in @@ -29,9 +29,9 @@ - Any additional methods for additional convenience or features. -Once the projection axes is defined, it can be used in one of two ways: +Once the projection Axes is defined, it can be used in one of two ways: -- By defining the class attribute ``name``, the projection axes can be +- By defining the class attribute ``name``, the projection Axes can be registered with `matplotlib.projections.register_projection` and subsequently simply invoked by name:: @@ -39,7 +39,7 @@ - For more complex, parameterisable projections, a generic "projection" object may be defined which includes the method ``_as_mpl_axes``. ``_as_mpl_axes`` - should take no arguments and return the projection's axes subclass and a + should take no arguments and return the projection's Axes subclass and a dictionary of additional arguments to pass to the subclass' ``__init__`` method. Subsequently a parameterised projection can be initialised with:: diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index f6fa0ea7b982..451899bd43b0 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -141,7 +141,7 @@ class PolarAffine(mtransforms.Affine2DBase): r""" The affine part of the polar projection. - Scales the output so that maximum radius rests on the edge of the axes + Scales the output so that maximum radius rests on the edge of the Axes circle and the origin is mapped to (0.5, 0.5). The transform applied is the same to x and y components and given by: @@ -504,7 +504,7 @@ class _ThetaShift(mtransforms.ScaledTranslation): Parameters ---------- axes : `~matplotlib.axes.Axes` - The owning axes; used to determine limits. + The owning Axes; used to determine limits. pad : float The padding to apply, in points. mode : {'min', 'max', 'rlabel'} @@ -739,7 +739,7 @@ def _is_full_circle_rad(thetamin, thetamax): class _WedgeBbox(mtransforms.Bbox): """ - Transform (theta, r) wedge Bbox into axes bounding box. + Transform (theta, r) wedge Bbox into Axes bounding box. Parameters ---------- diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 7f4aa12c9ed6..30bc22801e8e 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -17,7 +17,7 @@ plt.plot(x, y) The explicit object-oriented API is recommended for complex plots, though -pyplot is still usually used to create the figure and often the axes in the +pyplot is still usually used to create the figure and often the Axes in the figure. See `.pyplot.figure`, `.pyplot.subplots`, and `.pyplot.subplot_mosaic` to create figures, and :doc:`Axes API ` for the plotting methods on an Axes:: @@ -838,8 +838,8 @@ def figure( overlapping Axes decorations (labels, ticks, etc). Note that layout managers can measurably slow down figure display. - - 'constrained': The constrained layout solver adjusts axes sizes - to avoid overlapping axes decorations. Can handle complex plot + - 'constrained': The constrained layout solver adjusts Axes sizes + to avoid overlapping Axes decorations. Can handle complex plot layouts and colorbars, and is thus recommended. See :ref:`constrainedlayout_guide` @@ -847,7 +847,7 @@ def figure( - 'compressed': uses the same algorithm as 'constrained', but removes extra space between fixed-aspect-ratio Axes. Best for - simple grids of axes. + simple grids of Axes. - 'tight': Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the subplot parameters so that @@ -1179,7 +1179,7 @@ def axes( Returns ------- `~.axes.Axes`, or a subclass of `~.axes.Axes` - The returned axes class depends on the projection used. It is + The returned Axes class depends on the projection used. It is `~.axes.Axes` if rectilinear projection is used and `.projections.polar.PolarAxes` if polar projection is used. @@ -1226,7 +1226,7 @@ def axes( def delaxes(ax: matplotlib.axes.Axes | None = None) -> None: """ - Remove an `~.axes.Axes` (defaulting to the current axes) from its figure. + Remove an `~.axes.Axes` (defaulting to the current Axes) from its figure. """ if ax is None: ax = gca() @@ -1245,12 +1245,12 @@ def sca(ax: Axes) -> None: def cla() -> None: - """Clear the current axes.""" + """Clear the current Axes.""" # Not generated via boilerplate.py to allow a different docstring. return gca().cla() -## More ways of creating axes ## +## More ways of creating Axes ## @_docstring.dedent_interpd def subplot(*args, **kwargs) -> Axes: @@ -1297,10 +1297,10 @@ def subplot(*args, **kwargs) -> Axes: sharex, sharey : `~matplotlib.axes.Axes`, optional Share the x or y `~matplotlib.axis` with sharex and/or sharey. The axis will have the same limits, ticks, and scale as the axis of the - shared axes. + shared Axes. label : str - A label for the returned axes. + A label for the returned Axes. Returns ------- @@ -1313,7 +1313,7 @@ def subplot(*args, **kwargs) -> Axes: Other Parameters ---------------- **kwargs - This method also takes the keyword arguments for the returned axes + This method also takes the keyword arguments for the returned Axes base class; except for the *figure* argument. The keyword arguments for the rectilinear base class `~.axes.Axes` can be found in the following table but there might also be other keyword @@ -1331,7 +1331,7 @@ def subplot(*args, **kwargs) -> Axes: plt.plot([1, 2, 3]) # now create a subplot which represents the top plot of a grid # with 2 rows and 1 column. Since this subplot will overlap the - # first, the plot (and its axes) previously created, will be removed + # first, the plot (and its Axes) previously created, will be removed plt.subplot(211) If you do not want this behavior, use the `.Figure.add_subplot` method @@ -1382,7 +1382,7 @@ def subplot(*args, **kwargs) -> Axes: # add ax2 to the figure again plt.subplot(ax2) - # make the first axes "current" again + # make the first Axes "current" again plt.subplot(221) """ @@ -1425,7 +1425,7 @@ def subplot(*args, **kwargs) -> Axes: for ax in fig.axes: # If we found an Axes at the position, we can re-use it if the user passed no - # kwargs or if the axes class and kwargs are identical. + # kwargs or if the Axes class and kwargs are identical. if (ax.get_subplotspec() == key and (kwargs == {} or (ax._projection_init @@ -1572,7 +1572,7 @@ def subplots( ax1.set_title('Sharing Y axis') ax2.scatter(x, y) - # Create four polar axes and access them through the returned array + # Create four polar Axes and access them through the returned array fig, axs = plt.subplots(2, 2, subplot_kw=dict(projection="polar")) axs[0, 0].plot(x, y) axs[1, 1].scatter(x, y) @@ -1685,7 +1685,7 @@ def subplot_mosaic( x = [['A panel', 'A panel', 'edge'], ['C panel', '.', 'edge']] - produces 4 axes: + produces 4 Axes: - 'A panel' which is 1 row high and spans the first two columns - 'edge' which is 2 rows high and is on the right edge @@ -1763,7 +1763,7 @@ def subplot_mosaic( dict[label, Axes] A dictionary mapping the labels to the Axes objects. The order of - the axes is left-to-right and top-to-bottom of their position in the + the Axes is left-to-right and top-to-bottom of their position in the total layout. """ @@ -1833,8 +1833,8 @@ def subplot2grid( def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase: """ - Make and return a second axes that shares the *x*-axis. The new axes will - overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be + Make and return a second Axes that shares the *x*-axis. The new Axes will + overlay *ax* (or the current Axes if *ax* is *None*), and its ticks will be on the right. Examples @@ -1849,8 +1849,8 @@ def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase: def twiny(ax: matplotlib.axes.Axes | None = None) -> _AxesBase: """ - Make and return a second axes that shares the *y*-axis. The new axes will - overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be + Make and return a second Axes that shares the *y*-axis. The new Axes will + overlay *ax* (or the current Axes if *ax* is *None*), and its ticks will be on the top. Examples @@ -1888,7 +1888,7 @@ def subplot_tool(targetfig: Figure | None = None) -> SubplotTool | None: def box(on: bool | None = None) -> None: """ - Turn the axes box on or off on the current axes. + Turn the Axes box on or off on the current Axes. Parameters ---------- @@ -1911,7 +1911,7 @@ def box(on: bool | None = None) -> None: def xlim(*args, **kwargs) -> tuple[float, float]: """ - Get or set the x limits of the current axes. + Get or set the x limits of the current Axes. Call signatures:: @@ -1935,9 +1935,9 @@ def xlim(*args, **kwargs) -> tuple[float, float]: Notes ----- Calling this function with no arguments (e.g. ``xlim()``) is the pyplot - equivalent of calling `~.Axes.get_xlim` on the current axes. + equivalent of calling `~.Axes.get_xlim` on the current Axes. Calling this function with arguments is the pyplot equivalent of calling - `~.Axes.set_xlim` on the current axes. All arguments are passed though. + `~.Axes.set_xlim` on the current Axes. All arguments are passed though. """ ax = gca() if not args and not kwargs: @@ -1948,7 +1948,7 @@ def xlim(*args, **kwargs) -> tuple[float, float]: def ylim(*args, **kwargs) -> tuple[float, float]: """ - Get or set the y-limits of the current axes. + Get or set the y-limits of the current Axes. Call signatures:: @@ -1972,9 +1972,9 @@ def ylim(*args, **kwargs) -> tuple[float, float]: Notes ----- Calling this function with no arguments (e.g. ``ylim()``) is the pyplot - equivalent of calling `~.Axes.get_ylim` on the current axes. + equivalent of calling `~.Axes.get_ylim` on the current Axes. Calling this function with arguments is the pyplot equivalent of calling - `~.Axes.set_ylim` on the current axes. All arguments are passed though. + `~.Axes.set_ylim` on the current Axes. All arguments are passed though. """ ax = gca() if not args and not kwargs: @@ -2019,9 +2019,9 @@ def xticks( ----- Calling this function with no arguments (e.g. ``xticks()``) is the pyplot equivalent of calling `~.Axes.get_xticks` and `~.Axes.get_xticklabels` on - the current axes. + the current Axes. Calling this function with arguments is the pyplot equivalent of calling - `~.Axes.set_xticks` and `~.Axes.set_xticklabels` on the current axes. + `~.Axes.set_xticks` and `~.Axes.set_xticklabels` on the current Axes. Examples -------- @@ -2090,9 +2090,9 @@ def yticks( ----- Calling this function with no arguments (e.g. ``yticks()``) is the pyplot equivalent of calling `~.Axes.get_yticks` and `~.Axes.get_yticklabels` on - the current axes. + the current Axes. Calling this function with arguments is the pyplot equivalent of calling - `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current axes. + `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current Axes. Examples -------- @@ -2192,7 +2192,7 @@ def rgrids( """ ax = gca() if not isinstance(ax, PolarAxes): - raise RuntimeError('rgrids only defined for polar axes') + raise RuntimeError('rgrids only defined for polar Axes') if all(p is None for p in [radii, labels, angle, fmt]) and not kwargs: lines_out: list[Line2D] = ax.yaxis.get_gridlines() labels_out: list[Text] = ax.yaxis.get_ticklabels() @@ -2267,7 +2267,7 @@ def thetagrids( """ ax = gca() if not isinstance(ax, PolarAxes): - raise RuntimeError('thetagrids only defined for polar axes') + raise RuntimeError('thetagrids only defined for polar Axes') if all(param is None for param in [angles, labels, fmt]) and not kwargs: lines_out: list[Line2D] = ax.xaxis.get_ticklines() labels_out: list[Text] = ax.xaxis.get_ticklabels() @@ -2417,7 +2417,7 @@ def matshow(A: ArrayLike, fignum: None | int = None, **kwargs) -> AxesImage: If a nonzero integer, draw into the figure with the given number (create it if it does not exist). - If 0, use the current axes (or create one if it does not exist). + If 0, use the current Axes (or create one if it does not exist). .. note:: diff --git a/lib/matplotlib/table.py b/lib/matplotlib/table.py index d42cdf878d61..bfe9b4a6b65f 100644 --- a/lib/matplotlib/table.py +++ b/lib/matplotlib/table.py @@ -672,7 +672,7 @@ def table(ax, *colLoc* respectively. For finer grained control over tables, use the `.Table` class and add it to - the axes with `.Axes.add_table`. + the Axes with `.Axes.add_table`. Parameters ---------- diff --git a/lib/matplotlib/testing/widgets.py b/lib/matplotlib/testing/widgets.py index eb7551853653..748cdaccc7e9 100644 --- a/lib/matplotlib/testing/widgets.py +++ b/lib/matplotlib/testing/widgets.py @@ -12,7 +12,7 @@ def get_ax(): - """Create a plot and return its axes.""" + """Create a plot and return its Axes.""" fig, ax = plt.subplots(1, 1) ax.plot([0, 200], [0, 200]) ax.set_aspect(1.0) @@ -34,7 +34,7 @@ def mock_event(ax, button=1, xdata=0, ydata=0, key=None, step=1): Parameters ---------- ax : `~matplotlib.axes.Axes` - The axes the event will be in. + The Axes the event will be in. xdata : float x coord of mouse in data coords. ydata : float diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 564bf6a86b52..f908e5de133c 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -7577,7 +7577,7 @@ def test_axis_options(): def color_boxes(fig, ax): """ - Helper for the tests below that test the extents of various axes elements + Helper for the tests below that test the extents of various Axes elements """ fig.canvas.draw() diff --git a/lib/matplotlib/tests/test_constrainedlayout.py b/lib/matplotlib/tests/test_constrainedlayout.py index 6703dfe31523..4bcc1bdf75c6 100644 --- a/lib/matplotlib/tests/test_constrainedlayout.py +++ b/lib/matplotlib/tests/test_constrainedlayout.py @@ -347,7 +347,7 @@ def test_constrained_layout19(): def test_constrained_layout20(): - """Smoke test cl does not mess up added axes""" + """Smoke test cl does not mess up added Axes""" gx = np.linspace(-5, 5, 4) img = np.hypot(gx, gx[:, None]) diff --git a/lib/matplotlib/tests/test_polar.py b/lib/matplotlib/tests/test_polar.py index 9d6e78da2cbc..702bd5e64af1 100644 --- a/lib/matplotlib/tests/test_polar.py +++ b/lib/matplotlib/tests/test_polar.py @@ -95,7 +95,7 @@ def test_polar_twice(): fig = plt.figure() plt.polar([1, 2], [.1, .2]) plt.polar([3, 4], [.3, .4]) - assert len(fig.axes) == 1, 'More than one polar axes created.' + assert len(fig.axes) == 1, 'More than one polar Axes created.' @check_figures_equal() diff --git a/lib/matplotlib/tests/test_skew.py b/lib/matplotlib/tests/test_skew.py index df17b2f70a99..5760d6654ad7 100644 --- a/lib/matplotlib/tests/test_skew.py +++ b/lib/matplotlib/tests/test_skew.py @@ -1,5 +1,5 @@ """ -Testing that skewed axes properly work. +Testing that skewed Axes properly work. """ from contextlib import ExitStack diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py index 961daaa1d167..6d363a48aec8 100644 --- a/lib/matplotlib/tests/test_ticker.py +++ b/lib/matplotlib/tests/test_ticker.py @@ -334,7 +334,7 @@ def test_basic(self): def test_polar_axes(self): """ - Polar axes have a different ticking logic. + Polar Axes have a different ticking logic. """ fig, ax = plt.subplots(subplot_kw={'projection': 'polar'}) ax.set_yscale('log') diff --git a/lib/matplotlib/tests/test_tightlayout.py b/lib/matplotlib/tests/test_tightlayout.py index 968f0da7b514..422c9c1dd444 100644 --- a/lib/matplotlib/tests/test_tightlayout.py +++ b/lib/matplotlib/tests/test_tightlayout.py @@ -253,7 +253,7 @@ def _subplots(): def test_empty_layout(): - """Test that tight layout doesn't cause an error when there are no axes.""" + """Test that tight layout doesn't cause an error when there are no Axes.""" fig = plt.gcf() fig.tight_layout() diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index 7a58ce717200..493691722fab 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1545,10 +1545,10 @@ def set_annotation_clip(self, b): ---------- b : bool or None - True: The annotation will be clipped when ``self.xy`` is - outside the axes. + outside the Axes. - False: The annotation will always be drawn. - None: The annotation will be clipped when ``self.xy`` is - outside the axes and ``self.xycoords == "data"``. + outside the Axes and ``self.xycoords == "data"``. """ self._annotation_clip = b @@ -1570,7 +1570,7 @@ def _check_xy(self, renderer=None): renderer = self.figure._get_renderer() b = self.get_annotation_clip() if b or (b is None and self.xycoords == "data"): - # check if self.xy is inside the axes. + # check if self.xy is inside the Axes. xy_pixel = self._get_position_xy(renderer) return self.axes.contains_point(xy_pixel) return True @@ -1676,9 +1676,9 @@ def __init__(self, text, xy, 'subfigure points' Points from the lower left of the subfigure 'subfigure pixels' Pixels from the lower left of the subfigure 'subfigure fraction' Fraction of subfigure from lower left - 'axes points' Points from lower left corner of axes - 'axes pixels' Pixels from lower left corner of axes - 'axes fraction' Fraction of axes from lower left + 'axes points' Points from lower left corner of the Axes + 'axes pixels' Pixels from lower left corner of the Axes + 'axes fraction' Fraction of Axes from lower left 'data' Use the coordinate system of the object being annotated (default) 'polar' *(theta, r)* if not native 'data' @@ -1782,13 +1782,13 @@ def transform(renderer) -> Transform annotation_clip : bool or None, default: None Whether to clip (i.e. not draw) the annotation when the annotation - point *xy* is outside the axes area. + point *xy* is outside the Axes area. - If *True*, the annotation will be clipped when *xy* is outside - the axes. + the Axes. - If *False*, the annotation will always be drawn. - If *None*, the annotation will be clipped when *xy* is outside - the axes and *xycoords* is 'data'. + the Axes and *xycoords* is 'data'. **kwargs Additional kwargs are passed to `.Text`. diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 41114aafbf3e..cbc77662aa3b 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -1635,7 +1635,7 @@ def nonsingular(self, v0, v1): Adjust a range as needed to avoid singularities. This method gets called during autoscaling, with ``(v0, v1)`` set to - the data limits on the axes if the axes contains any data, or + the data limits on the Axes if the Axes contains any data, or ``(-inf, +inf)`` if not. - If ``v0 == v1`` (possibly up to some floating point slop), this @@ -1997,7 +1997,7 @@ def __init__(self, nbins=None, **kwargs): prune : {'lower', 'upper', 'both', None}, default: None Remove edge ticks -- useful for stacked or ganged plots where - the upper tick of one axes overlaps with the lower tick of the + the upper tick of one Axes overlaps with the lower tick of the axes above it, primarily when :rc:`axes.autolimit_mode` is ``'round_numbers'``. If ``prune=='lower'``, the smallest tick will be removed. If ``prune == 'upper'``, the largest tick will be diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index cd9716408303..5368a27a83c9 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -152,7 +152,7 @@ def disconnect_events(self): def _get_data_coords(self, event): """Return *event*'s data coordinates in this widget's Axes.""" # This method handles the possibility that event.inaxes != self.ax (which may - # occur if multiple axes are overlaid), in which case event.xdata/.ydata will + # occur if multiple Axes are overlaid), in which case event.xdata/.ydata will # be wrong. Note that we still special-case the common case where # event.inaxes == self.ax and avoid re-running the inverse data transform, # because that can introduce floating point errors for synthetic events. @@ -2261,7 +2261,7 @@ def _clean_event(self, event): Preprocess an event: - Replace *event* by the previous event if *event* has no ``xdata``. - - Get ``xdata`` and ``ydata`` from this widget's axes, and clip them to the axes + - Get ``xdata`` and ``ydata`` from this widget's Axes, and clip them to the axes limits. - Update the previous event. """ @@ -3057,7 +3057,7 @@ def closest(self, x, y): Parameters ---------- ax : `~matplotlib.axes.Axes` - The parent axes for the widget. + The parent Axes for the widget. onselect : function A callback function that is called after a release event and the diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 0c18bce8ebd3..524c0901bf94 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -69,7 +69,7 @@ def __init__( fig : Figure The parent figure. rect : tuple (left, bottom, width, height), default: None. - The ``(left, bottom, width, height)`` axes position. + The ``(left, bottom, width, height)`` Axes position. elev : float, default: 30 The elevation angle in degrees rotates the camera above and below the x-y plane, with a positive angle corresponding to a location @@ -214,7 +214,7 @@ def set_top_view(self): self.stale = True def _init_axis(self): - """Init 3D axes; overrides creation of regular X/Y axes.""" + """Init 3D Axes; overrides creation of regular X/Y Axes.""" self.xaxis = axis3d.XAxis(self) self.yaxis = axis3d.YAxis(self) self.zaxis = axis3d.ZAxis(self) @@ -1079,7 +1079,7 @@ def get_zlim(self): Parameters ---------- value : {{"linear"}} - The axis scale type to apply. 3D axes currently only support + The axis scale type to apply. 3D Axes currently only support linear scales; other scales yield nonsensical results. **kwargs @@ -1103,20 +1103,20 @@ def get_zlim(self): Notes ----- - This function is merely provided for completeness, but 3D axes do not + This function is merely provided for completeness, but 3D Axes do not support dates for ticks, and so this may not work as expected. """) def clabel(self, *args, **kwargs): - """Currently not implemented for 3D axes, and returns *None*.""" + """Currently not implemented for 3D Axes, and returns *None*.""" return None def view_init(self, elev=None, azim=None, roll=None, vertical_axis="z", share=False): """ - Set the elevation and azimuth of the axes in degrees (not radians). + Set the elevation and azimuth of the Axes in degrees (not radians). - This can be used to rotate the axes programmatically. + This can be used to rotate the Axes programmatically. To look normal to the primary planes, the following elevation and azimuth angles can be used. A roll angle of 0, 90, 180, or 270 deg @@ -1285,11 +1285,11 @@ def mouse_init(self, rotate_btn=1, pan_btn=2, zoom_btn=3): Parameters ---------- rotate_btn : int or list of int, default: 1 - The mouse button or buttons to use for 3D rotation of the axes. + The mouse button or buttons to use for 3D rotation of the Axes. pan_btn : int or list of int, default: 2 - The mouse button or buttons to use to pan the 3D axes. + The mouse button or buttons to use to pan the 3D Axes. zoom_btn : int or list of int, default: 3 - The mouse button or buttons to use to zoom the 3D axes. + The mouse button or buttons to use to zoom the 3D Axes. """ self.button_pressed = None # coerce scalars into array-like, then convert into @@ -1685,7 +1685,7 @@ def _zoom_data_limits(self, scale_u, scale_v, scale_w): transformed to the x, y, z data axes based on the current view angles. A scale factor > 1 zooms out and a scale factor < 1 zooms in. - For an axes that has had its aspect ratio set to 'equal', 'equalxy', + For an Axes that has had its aspect ratio set to 'equal', 'equalxy', 'equalyz', or 'equalxz', the relevant axes are constrained to zoom equally. @@ -1800,7 +1800,7 @@ def tick_params(self, axis='both', **kwargs): to 'both' autoscales all three axes. Also, because of how Axes3D objects are drawn very differently - from regular 2D axes, some of these settings may have + from regular 2D Axes, some of these settings may have ambiguous meaning. For simplicity, the 'z' axis will accept settings as if it was like the 'y' axis.