Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb8969b

Browse files
authored
Merge pull request #9649 from anntzer/axes-apidoc
Reoder Axes API docs.
2 parents 0e3dd2d + e4178d8 commit bb8969b

File tree

2 files changed

+53
-80
lines changed

2 files changed

+53
-80
lines changed

doc/api/axes_api.rst

Lines 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

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,9 +1612,7 @@ def axis(self, *v, **kwargs):
16121612
return v
16131613

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

16201618
def get_images(self):
@@ -1626,30 +1624,30 @@ def get_lines(self):
16261624
return cbook.silent_list('Line2D', self.lines)
16271625

16281626
def get_xaxis(self):
1629-
"""Return the XAxis instance"""
1627+
"""Return the XAxis instance."""
16301628
return self.xaxis
16311629

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

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

16421640
def get_yaxis(self):
1643-
"""Return the YAxis instance"""
1641+
"""Return the YAxis instance."""
16441642
return self.yaxis
16451643

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

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

@@ -2746,27 +2744,16 @@ def set_axis_bgcolor(self, color):
27462744
# data limits, ticks, tick labels, and formatting
27472745

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

27532750
def xaxis_inverted(self):
2754-
"""Returns *True* if the x-axis is inverted."""
2751+
"""Return whether the x-axis is inverted."""
27552752
left, right = self.get_xlim()
27562753
return right < left
27572754

27582755
def get_xbound(self):
2759-
"""Returns the x-axis numerical bounds
2760-
2761-
This always returns::
2762-
2763-
lowerBound < upperBound
2764-
2765-
Returns
2766-
-------
2767-
lowerBound, upperBound : float
2768-
2769-
"""
2756+
"""Return the lower and upper x-axis bounds, in increasing order."""
27702757
left, right = self.get_xlim()
27712758
if left < right:
27722759
return left, right
@@ -3002,7 +2989,7 @@ def set_xticks(self, ticks, minor=False):
30022989

30032990
def get_xmajorticklabels(self):
30042991
"""
3005-
Get the xtick major labels
2992+
Get the major x tick labels.
30062993
30072994
Returns
30082995
-------
@@ -3014,7 +3001,7 @@ def get_xmajorticklabels(self):
30143001

30153002
def get_xminorticklabels(self):
30163003
"""
3017-
Get the x minor tick labels
3004+
Get the minor x tick labels.
30183005
30193006
Returns
30203007
-------
@@ -3086,22 +3073,16 @@ def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs):
30863073
return ret
30873074

30883075
def invert_yaxis(self):
3089-
"""
3090-
Invert the y-axis.
3091-
"""
3092-
bottom, top = self.get_ylim()
3093-
self.set_ylim(top, bottom, auto=None)
3076+
"""Invert the y-axis."""
3077+
self.set_ylim(self.get_ylim()[::-1], auto=None)
30943078

30953079
def yaxis_inverted(self):
3096-
"""Returns *True* if the y-axis is inverted."""
3080+
"""Return whether the y-axis is inverted."""
30973081
bottom, top = self.get_ylim()
30983082
return top < bottom
30993083

31003084
def get_ybound(self):
3101-
"""
3102-
Return y-axis numerical bounds in the form of
3103-
``lowerBound < upperBound``
3104-
"""
3085+
"""Return the lower and upper y-axis bounds, in increasing order."""
31053086
bottom, top = self.get_ylim()
31063087
if bottom < top:
31073088
return bottom, top
@@ -3316,7 +3297,7 @@ def set_yticks(self, ticks, minor=False):
33163297

33173298
def get_ymajorticklabels(self):
33183299
"""
3319-
Get the major y tick labels
3300+
Get the major y tick labels.
33203301
33213302
Returns
33223303
-------
@@ -3328,7 +3309,7 @@ def get_ymajorticklabels(self):
33283309

33293310
def get_yminorticklabels(self):
33303311
"""
3331-
Get the minor y tick labels
3312+
Get the minor y tick labels.
33323313
33333314
Returns
33343315
-------

0 commit comments

Comments
 (0)