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

Skip to content

Commit f2c2890

Browse files
authored
Merge pull request #12487 from anntzer/update-docs
Update docs/tests for the deprecation of aname and label1On/label2On/etc.
2 parents 0ca0c40 + fdc7d62 commit f2c2890

File tree

6 files changed

+29
-64
lines changed

6 files changed

+29
-64
lines changed

doc/api/artist_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ Metadata
170170
Artist.get_label
171171
Artist.set_url
172172
Artist.get_url
173-
Artist.aname
174173

175174
Stale
176175
-----

doc/api/axes_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,6 @@ Other
672672
:nosignatures:
673673

674674
Axes.zorder
675-
Axes.aname
676675
Axes.get_default_bbox_extra_artists
677676
Axes.get_transformed_clip_path_and_affine
678677
Axes.has_data

doc/api/axis_api.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ Ticks
470470

471471

472472
Tick.add_callback
473-
Tick.aname
474473
Tick.axes
475474
Tick.contains
476475
Tick.convert_xunits
@@ -536,7 +535,6 @@ Ticks
536535
Tick.zorder
537536

538537
XTick.add_callback
539-
XTick.aname
540538
XTick.axes
541539
XTick.contains
542540
XTick.convert_xunits
@@ -602,7 +600,6 @@ Ticks
602600
XTick.zorder
603601

604602
YTick.add_callback
605-
YTick.aname
606603
YTick.axes
607604
YTick.contains
608605
YTick.convert_xunits
@@ -678,7 +675,6 @@ Axis
678675

679676

680677
Axis.add_callback
681-
Axis.aname
682678
Axis.axes
683679
Axis.contains
684680
Axis.convert_xunits
@@ -744,7 +740,6 @@ Axis
744740
Axis.zorder
745741

746742
XAxis.add_callback
747-
XAxis.aname
748743
XAxis.axes
749744
XAxis.contains
750745
XAxis.convert_xunits
@@ -810,7 +805,6 @@ Axis
810805
XAxis.zorder
811806

812807
YAxis.add_callback
813-
YAxis.aname
814808
YAxis.axes
815809
YAxis.contains
816810
YAxis.convert_xunits

examples/pyplots/dollar_ticks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
ax.yaxis.set_major_formatter(formatter)
2020

2121
for tick in ax.yaxis.get_major_ticks():
22-
tick.label1On = False
23-
tick.label2On = True
22+
tick.label1.set_visible(False)
23+
tick.label2.set_visible(True)
2424
tick.label2.set_color('green')
2525

2626
plt.show()

lib/matplotlib/tests/test_axes.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5377,10 +5377,10 @@ def test_axes_tick_params_ylabelside():
53775377
ax.tick_params(labelleft=False, labelright=True,
53785378
which='minor')
53795379
# expects left false, right true
5380-
assert ax.yaxis.majorTicks[0].label1On is False
5381-
assert ax.yaxis.majorTicks[0].label2On is True
5382-
assert ax.yaxis.minorTicks[0].label1On is False
5383-
assert ax.yaxis.minorTicks[0].label2On is True
5380+
assert ax.yaxis.majorTicks[0].label1.get_visible() is False
5381+
assert ax.yaxis.majorTicks[0].label2.get_visible() is True
5382+
assert ax.yaxis.minorTicks[0].label1.get_visible() is False
5383+
assert ax.yaxis.minorTicks[0].label2.get_visible() is True
53845384

53855385

53865386
def test_axes_tick_params_xlabelside():
@@ -5391,12 +5391,12 @@ def test_axes_tick_params_xlabelside():
53915391
ax.tick_params(labeltop=True, labelbottom=False,
53925392
which='minor')
53935393
# expects top True, bottom False
5394-
# label1On mapped to labelbottom
5395-
# label2On mapped to labeltop
5396-
assert ax.xaxis.majorTicks[0].label1On is False
5397-
assert ax.xaxis.majorTicks[0].label2On is True
5398-
assert ax.xaxis.minorTicks[0].label1On is False
5399-
assert ax.xaxis.minorTicks[0].label2On is True
5394+
# label1.get_visible() mapped to labelbottom
5395+
# label2.get_visible() mapped to labeltop
5396+
assert ax.xaxis.majorTicks[0].label1.get_visible() is False
5397+
assert ax.xaxis.majorTicks[0].label2.get_visible() is True
5398+
assert ax.xaxis.minorTicks[0].label1.get_visible() is False
5399+
assert ax.xaxis.minorTicks[0].label2.get_visible() is True
54005400

54015401

54025402
def test_none_kwargs():

tutorials/intermediate/artists.py

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
4545
import matplotlib.pyplot as plt
4646
fig = plt.figure()
47-
ax = fig.add_subplot(2,1,1) # two rows, one column, first plot
47+
ax = fig.add_subplot(2, 1, 1) # two rows, one column, first plot
4848
4949
The :class:`~matplotlib.axes.Axes` is probably the most important
5050
class in the matplotlib API, and the one you will be working with most
@@ -117,24 +117,6 @@ class in the matplotlib API, and the one you will be working with most
117117
:class:`~matplotlib.axis.YAxis` instance, which handle the layout and
118118
drawing of the ticks, tick labels and axis labels.
119119
120-
.. I'm commenting this out, since the new Sphinx cross-references
121-
.. sort of take care of this above - MGD
122-
123-
.. Here are the most important matplotlib modules that contain the
124-
.. classes referenced above
125-
126-
.. =============== ==================
127-
.. Artist Module
128-
.. =============== ==================
129-
.. Artist matplotlib.artist
130-
.. Rectangle matplotlib.patches
131-
.. Line2D matplotlib.lines
132-
.. Axes matplotlib.axes
133-
.. XAxis and YAxis matplotlib.axis
134-
.. Figure matplotlib.figure
135-
.. Text matplotlib.text
136-
.. =============== ==================
137-
138120
Try creating the figure below.
139121
"""
140122

@@ -186,7 +168,7 @@ class in the matplotlib API, and the one you will be working with most
186168
# ========== ================================================================================
187169
# Property Description
188170
# ========== ================================================================================
189-
# alpha The transparency - a scalar from 0-1
171+
# alpha The transparency - a scalar from 0-1
190172
# animated A boolean that is used to facilitate animated drawing
191173
# axes The axes that the Artist lives in, possibly None
192174
# clip_box The bounding box that clips the Artist
@@ -199,7 +181,7 @@ class in the matplotlib API, and the one you will be working with most
199181
# transform The transformation
200182
# visible A boolean whether the artist should be drawn
201183
# zorder A number which determines the drawing order
202-
# rasterized Boolean; Turns vectors into rastergraphics: (for compression & eps transparency)
184+
# rasterized Boolean; Turns vectors into raster graphics (for compression & eps transparency)
203185
# ========== ================================================================================
204186
#
205187
# Each of the properties is accessed with an old-fashioned setter or
@@ -252,8 +234,6 @@ class in the matplotlib API, and the one you will be working with most
252234
# y = 0
253235
# zorder = 1
254236
#
255-
# .. TODO: Update these URLs
256-
#
257237
# The docstrings for all of the classes also contain the ``Artist``
258238
# properties, so you can consult the interactive "help" or the
259239
# :ref:`artist-api` for a listing of properties for a given object.
@@ -351,17 +331,17 @@ class in the matplotlib API, and the one you will be working with most
351331
#
352332
# .. TODO: Add xrefs to this table
353333
#
354-
# ================ ===============================================================
355-
# Figure attribute Description
356-
# ================ ===============================================================
357-
# axes A list of Axes instances (includes Subplot)
358-
# patch The Rectangle background
359-
# images A list of FigureImages patches - useful for raw pixel display
360-
# legends A list of Figure Legend instances (different from Axes.legends)
361-
# lines A list of Figure Line2D instances (rarely used, see Axes.lines)
362-
# patches A list of Figure patches (rarely used, see Axes.patches)
363-
# texts A list Figure Text instances
364-
# ================ ===============================================================
334+
# ================ ===============================================================
335+
# Figure attribute Description
336+
# ================ ===============================================================
337+
# axes A list of Axes instances (includes Subplot)
338+
# patch The Rectangle background
339+
# images A list of FigureImages patches - useful for raw pixel display
340+
# legends A list of Figure Legend instances (different from Axes.legends)
341+
# lines A list of Figure Line2D instances (rarely used, see Axes.lines)
342+
# patches A list of Figure patches (rarely used, see Axes.patches)
343+
# texts A list Figure Text instances
344+
# ================ ===============================================================
365345
#
366346
# .. _axes-container:
367347
#
@@ -654,9 +634,7 @@ class in the matplotlib API, and the one you will be working with most
654634
# to the :class:`~matplotlib.axis.Tick`. The ``Tick`` contains the tick
655635
# and grid line instances, as well as the label instances for the upper
656636
# and lower ticks. Each of these is accessible directly as an attribute
657-
# of the ``Tick``. In addition, there are boolean variables that determine
658-
# whether the upper labels and ticks are on for the x-axis and whether
659-
# the right labels and ticks are on for the y-axis.
637+
# of the ``Tick``.
660638
#
661639
# ============== ==========================================================
662640
# Tick attribute Description
@@ -666,11 +644,6 @@ class in the matplotlib API, and the one you will be working with most
666644
# gridline Line2D instance
667645
# label1 Text instance
668646
# label2 Text instance
669-
# gridOn boolean which determines whether to draw the gridline
670-
# tick1On boolean which determines whether to draw the 1st tickline
671-
# tick2On boolean which determines whether to draw the 2nd tickline
672-
# label1On boolean which determines whether to draw the 1st tick label
673-
# label2On boolean which determines whether to draw the 2nd tick label
674647
# ============== ==========================================================
675648
#
676649
# Here is an example which sets the formatter for the right side ticks with
@@ -688,8 +661,8 @@ class in the matplotlib API, and the one you will be working with most
688661
ax.yaxis.set_major_formatter(formatter)
689662

690663
for tick in ax.yaxis.get_major_ticks():
691-
tick.label1On = False
692-
tick.label2On = True
664+
tick.label1.set_visible(False)
665+
tick.label2.set_visible(True)
693666
tick.label2.set_color('green')
694667

695668
plt.show()

0 commit comments

Comments
 (0)