Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 95b16ad

Browse filesBrowse files
jklymakMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #9649: Reoder Axes API docs.
1 parent 24ba7a8 commit 95b16ad
Copy full SHA for 95b16ad

File tree

Expand file treeCollapse file tree

2 files changed

+53
-80
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+53
-80
lines changed

‎doc/api/axes_api.rst

Copy file name to clipboardExpand all lines: doc/api/axes_api.rst
+33-41Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,16 @@ Property cycle
239239
Axis / limits
240240
=============
241241

242+
.. For families of methods of the form {get,set}_{x,y}foo, try to list them in
243+
the order set_xfoo, get_xfoo, set_yfoo, get_yfoo
244+
242245
.. autosummary::
243246
:toctree: _as_gen
244247
:template: autosummary.rst
245248
:nosignatures:
246249

247-
248-
Axes.get_yaxis
249250
Axes.get_xaxis
250-
251-
251+
Axes.get_yaxis
252252

253253
Axis Limits and direction
254254
-------------------------
@@ -259,23 +259,22 @@ Axis Limits and direction
259259
:nosignatures:
260260

261261
Axes.invert_xaxis
262-
Axes.invert_yaxis
263262
Axes.xaxis_inverted
263+
Axes.invert_yaxis
264264
Axes.yaxis_inverted
265265

266266
Axes.set_xlim
267+
Axes.get_xlim
267268
Axes.set_ylim
268269
Axes.get_ylim
269-
Axes.get_xlim
270270

271271
Axes.update_datalim
272272
Axes.update_datalim_bounds
273-
Axes.update_datalim_numerix
274273

275-
Axes.set_ybound
276274
Axes.set_xbound
277-
Axes.get_ybound
278275
Axes.get_xbound
276+
Axes.set_ybound
277+
Axes.get_ybound
279278

280279
Axis Labels, title, and legend
281280
------------------------------
@@ -285,19 +284,17 @@ Axis Labels, title, and legend
285284
:template: autosummary.rst
286285
:nosignatures:
287286

288-
Axes.get_xlabel
289-
Axes.get_ylabel
290-
291287
Axes.set_xlabel
288+
Axes.get_xlabel
292289
Axes.set_ylabel
290+
Axes.get_ylabel
293291

294292
Axes.set_title
295293
Axes.get_title
296294
Axes.legend
297295
Axes.get_legend
298296
Axes.get_legend_handles_labels
299297

300-
301298
Axis scales
302299
-----------
303300

@@ -308,11 +305,8 @@ Axis scales
308305

309306
Axes.set_xscale
310307
Axes.get_xscale
311-
312-
Axes.get_yscale
313308
Axes.set_yscale
314-
315-
309+
Axes.get_yscale
316310

317311
Autoscaling and margins
318312
-----------------------
@@ -333,15 +327,14 @@ Autoscaling and margins
333327
Axes.autoscale
334328
Axes.autoscale_view
335329

336-
Axes.get_autoscale_on
337330
Axes.set_autoscale_on
331+
Axes.get_autoscale_on
338332

339-
Axes.get_autoscalex_on
340333
Axes.set_autoscalex_on
334+
Axes.get_autoscalex_on
341335

342-
Axes.get_autoscaley_on
343336
Axes.set_autoscaley_on
344-
337+
Axes.get_autoscaley_on
345338

346339
Aspect ratio
347340
------------
@@ -352,56 +345,55 @@ Aspect ratio
352345
:nosignatures:
353346

354347
Axes.apply_aspect
355-
Axes.get_aspect
356348
Axes.set_aspect
349+
Axes.get_aspect
357350

358-
Axes.get_adjustable
359351
Axes.set_adjustable
360-
352+
Axes.get_adjustable
361353

362354
Ticks and tick labels
363355
---------------------
364356

365-
366357
.. autosummary::
367358
:toctree: _as_gen
368359
:template: autosummary.rst
369360
:nosignatures:
370361

371-
Axes.xaxis_date
372-
Axes.yaxis_date
362+
Axes.set_xticks
363+
Axes.get_xticks
373364

365+
Axes.set_xticklabels
366+
Axes.get_xticklabels
374367
Axes.get_xmajorticklabels
375368
Axes.get_xminorticklabels
376-
Axes.get_xticklabels
369+
370+
Axes.get_xgridlines
377371
Axes.get_xticklines
378-
Axes.get_xticks
379372

380-
Axes.get_ymajorticklabels
381-
Axes.get_yminorticklabels
382-
Axes.get_yticklabels
383-
Axes.get_yticklines
384-
Axes.get_yticks
373+
Axes.xaxis_date
385374

386-
Axes.minorticks_off
387-
Axes.minorticks_on
375+
Axes.set_yticks
376+
Axes.get_yticks
388377

389-
Axes.set_xticklabels
390-
Axes.set_xticks
391378
Axes.set_yticklabels
392-
Axes.set_yticks
379+
Axes.get_yticklabels
380+
Axes.get_ymajorticklabels
381+
Axes.get_yminorticklabels
393382

394-
Axes.get_xgridlines
395383
Axes.get_ygridlines
384+
Axes.get_yticklines
385+
386+
Axes.yaxis_date
396387

388+
Axes.minorticks_off
389+
Axes.minorticks_on
397390

398391
Axes.ticklabel_format
399392
Axes.tick_params
400393

401394
Axes.locator_params
402395

403396

404-
405397
Units
406398
=====
407399

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+20-39Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,9 +1611,7 @@ def axis(self, *v, **kwargs):
16111611
return v
16121612

16131613
def get_legend(self):
1614-
"""
1615-
Return the legend.Legend instance, or None if no legend is defined
1616-
"""
1614+
"""Return the `Legend` instance, or None if no legend is defined."""
16171615
return self.legend_
16181616

16191617
def get_images(self):
@@ -1625,30 +1623,30 @@ def get_lines(self):
16251623
return cbook.silent_list('Line2D', self.lines)
16261624

16271625
def get_xaxis(self):
1628-
"""Return the XAxis instance"""
1626+
"""Return the XAxis instance."""
16291627
return self.xaxis
16301628

16311629
def get_xgridlines(self):
1632-
"""Get the x grid lines as a list of Line2D instances"""
1630+
"""Get the x grid lines as a list of `Line2D` instances."""
16331631
return cbook.silent_list('Line2D xgridline',
16341632
self.xaxis.get_gridlines())
16351633

16361634
def get_xticklines(self):
1637-
"""Get the xtick lines as a list of Line2D instances"""
1638-
return cbook.silent_list('Text xtickline',
1635+
"""Get the x tick lines as a list of `Line2D` instances."""
1636+
return cbook.silent_list('Line2D xtickline',
16391637
self.xaxis.get_ticklines())
16401638

16411639
def get_yaxis(self):
1642-
"""Return the YAxis instance"""
1640+
"""Return the YAxis instance."""
16431641
return self.yaxis
16441642

16451643
def get_ygridlines(self):
1646-
"""Get the y grid lines as a list of Line2D instances"""
1644+
"""Get the y grid lines as a list of `Line2D` instances."""
16471645
return cbook.silent_list('Line2D ygridline',
16481646
self.yaxis.get_gridlines())
16491647

16501648
def get_yticklines(self):
1651-
"""Get the ytick lines as a list of Line2D instances"""
1649+
"""Get the y tick lines as a list of `Line2D` instances."""
16521650
return cbook.silent_list('Line2D ytickline',
16531651
self.yaxis.get_ticklines())
16541652

@@ -2745,27 +2743,16 @@ def set_axis_bgcolor(self, color):
27452743
# data limits, ticks, tick labels, and formatting
27462744

27472745
def invert_xaxis(self):
2748-
"Invert the x-axis."
2749-
left, right = self.get_xlim()
2750-
self.set_xlim(right, left, auto=None)
2746+
"""Invert the x-axis."""
2747+
self.set_xlim(self.get_xlim()[::-1], auto=None)
27512748

27522749
def xaxis_inverted(self):
2753-
"""Returns *True* if the x-axis is inverted."""
2750+
"""Return whether the x-axis is inverted."""
27542751
left, right = self.get_xlim()
27552752
return right < left
27562753

27572754
def get_xbound(self):
2758-
"""Returns the x-axis numerical bounds
2759-
2760-
This always returns::
2761-
2762-
lowerBound < upperBound
2763-
2764-
Returns
2765-
-------
2766-
lowerBound, upperBound : float
2767-
2768-
"""
2755+
"""Return the lower and upper x-axis bounds, in increasing order."""
27692756
left, right = self.get_xlim()
27702757
if left < right:
27712758
return left, right
@@ -3001,7 +2988,7 @@ def set_xticks(self, ticks, minor=False):
30012988

30022989
def get_xmajorticklabels(self):
30032990
"""
3004-
Get the xtick major labels
2991+
Get the major x tick labels.
30052992
30062993
Returns
30072994
-------
@@ -3013,7 +3000,7 @@ def get_xmajorticklabels(self):
30133000

30143001
def get_xminorticklabels(self):
30153002
"""
3016-
Get the x minor tick labels
3003+
Get the minor x tick labels.
30173004
30183005
Returns
30193006
-------
@@ -3085,22 +3072,16 @@ def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs):
30853072
return ret
30863073

30873074
def invert_yaxis(self):
3088-
"""
3089-
Invert the y-axis.
3090-
"""
3091-
bottom, top = self.get_ylim()
3092-
self.set_ylim(top, bottom, auto=None)
3075+
"""Invert the y-axis."""
3076+
self.set_ylim(self.get_ylim()[::-1], auto=None)
30933077

30943078
def yaxis_inverted(self):
3095-
"""Returns *True* if the y-axis is inverted."""
3079+
"""Return whether the y-axis is inverted."""
30963080
bottom, top = self.get_ylim()
30973081
return top < bottom
30983082

30993083
def get_ybound(self):
3100-
"""
3101-
Return y-axis numerical bounds in the form of
3102-
``lowerBound < upperBound``
3103-
"""
3084+
"""Return the lower and upper y-axis bounds, in increasing order."""
31043085
bottom, top = self.get_ylim()
31053086
if bottom < top:
31063087
return bottom, top
@@ -3315,7 +3296,7 @@ def set_yticks(self, ticks, minor=False):
33153296

33163297
def get_ymajorticklabels(self):
33173298
"""
3318-
Get the major y tick labels
3299+
Get the major y tick labels.
33193300
33203301
Returns
33213302
-------
@@ -3327,7 +3308,7 @@ def get_ymajorticklabels(self):
33273308

33283309
def get_yminorticklabels(self):
33293310
"""
3330-
Get the minor y tick labels
3311+
Get the minor y tick labels.
33313312
33323313
Returns
33333314
-------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.