8000 Update docs/tests for the deprecation of aname and label1On/label2On/etc. by anntzer · Pull Request #12487 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Update docs/tests for the deprecation of aname and label1On/label2On/etc. #12487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion doc/api/artist_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ Metadata
Artist.get_label
Artist.set_url
Artist.get_url
Artist.aname

Stale
-----
Expand Down
1 change: 0 additions & 1 deletion doc/api/axes_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ Other
:nosignatures:

Axes.zorder
Axes.aname
Axes.get_default_bbox_extra_artists
Axes.get_transformed_clip_path_and_affine
Axes.has_data
Expand Down
6 changes: 0 additions & 6 deletions doc/api/axis_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ Ticks


Tick.add_callback
Tick.aname
Tick.axes
Tick.contains
Tick.convert_xunits
Expand Down Expand Up @@ -536,7 +535,6 @@ Ticks
Tick.zorder

XTick.add_callback
XTick.aname
XTick.axes
XTick.contains
XTick.convert_xunits
Expand Down Expand Up @@ -602,7 +600,6 @@ Ticks
XTick.zorder

YTick.add_callback
YTick.aname
YTick.axes
YTick.contains
YTick.convert_xunits
Expand Down Expand Up @@ -678,7 +675,6 @@ Axis


Axis.add_callback
Axis.aname
Axis.axes
Axis.contains
Axis.convert_xunits
Expand Down Expand Up @@ -744,7 +740,6 @@ Axis
Axis.zorder

XAxis.add_callback
XAxis.aname
XAxis.axes
XAxis.contains
XAxis.convert_xunits
Expand Down Expand Up @@ -810,7 +805,6 @@ Axis
XAxis.zorder

YAxis.add_callback
YAxis.aname
YAxis.axes
YAxis.contains
YAxis.convert_xunits
Expand Down
4 changes: 2 additions & 2 deletions examples/pyplots/dollar_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
ax.yaxis.set_major_formatter(formatter)

for tick in ax.yaxis.get_major_ticks():
tick.label1On = False
tick.label2On = True
tick.label1.set_visible(False)
tick.label2.set_visible(True)
tick.label2.set_color('green')

plt.show()
Expand Down
20 changes: 10 additions & 10 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5371,10 +5371,10 @@ def test_axes_tick_params_ylabelside():
ax.tick_params(labelleft=False, labelright=True,
which='minor')
# expects left false, right true
assert ax.yaxis.majorTicks[0].label1On is False
assert ax.yaxis.majorTicks[0].label2On is True
assert ax.yaxis.minorTicks[0].label1On is False
assert ax.yaxis.minorTicks[0].label2On is True
assert ax.yaxis.majorTicks[0].label1.get_visible() is False
assert ax.yaxis.majorTicks[0].label2.get_visible() is True
assert ax.yaxis.minorTicks[0].label1.get_visible() is False
assert ax.yaxis.minorTicks[0].label2.get_visible() is True


def test_axes_tick_params_xlabelside():
Expand All @@ -5385,12 +5385,12 @@ def test_axes_tick_params_xlabelside():
ax.tick_params(labeltop=True, labelbottom=False,
which='minor')
# expects top True, bottom False
# label1On mapped to labelbottom
# label2On mapped to labeltop
assert ax.xaxis.majorTicks[0].label1On is False
assert ax.xaxis.majorTicks[0].label2On is True
assert ax.xaxis.minorTicks[0].label1On is False
assert ax.xaxis.minorTicks[0].label2On is True
# label1.get_visible() mapped to labelbottom
# label2.get_visible() mapped to labeltop
assert ax.xaxis.majorTicks[0].label1.get_visible() is False
assert ax.xaxis.majorTicks[0].label2.get_visible() is True
assert ax.xaxis.minorTicks[0].label1.get_visible() is False
assert ax.xaxis.minorTicks[0].label2.get_visible() is True


def test_none_kwargs():
Expand Down
61 changes: 17 additions & 44 deletions tutorials/intermediate/artists.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(2,1,1) # two rows, one column, first plot
ax = fig.add_subplot(2, 1, 1) # two rows, one column, first plot

The :class:`~matplotlib.axes.Axes` is probably the most important
class in the matplotlib API, and the one you will be working with most
Expand Down Expand Up @@ -117,24 +117,6 @@ class in the matplotlib API, and the one you will be working with most
:class:`~matplotlib.axis.YAxis` instance, which handle the layout and
drawing of the ticks, tick labels and axis labels.

.. I'm commenting this out, since the new Sphinx cross-references
.. sort of take care of this above - MGD

.. Here are the most important matplotlib modules that contain the
.. classes referenced above

.. =============== ==================
.. Artist Module
.. =============== ==================
.. Artist matplotlib.artist
.. Rectangle matplotlib.patches
.. Line2D matplotlib.lines
.. Axes matplotlib.axes
.. XAxis and YAxis matplotlib.axis
.. Figure matplotlib.figure
.. Text matplotlib.text A36C
.. =============== ==================

Try creating the figure below.
"""

Expand Down Expand Up @@ -186,7 +168,7 @@ class in the matplotlib API, and the one you will be working with most
# ========== ================================================================================
# Property Description
# ========== ================================================================================
# alpha The transparency - a scalar from 0-1
# alpha The transparency - a scalar from 0-1
# animated A boolean that is used to facilitate animated drawing
# axes The axes that the Artist lives in, possibly None
# clip_box The bounding box that clips the Artist
Expand All @@ -199,7 +181,7 @@ class in the matplotlib API, and the one you will be working with most
# transform The transformation
# visible A boolean whether the artist should be drawn
# zorder A number which determines the drawing order
# rasterized Boolean; Turns vectors into rastergraphics: (for compression & eps transparency)
# rasterized Boolean; Turns vectors into raster graphics (for compression & eps transparency)
# ========== ================================================================================
#
# Each of the properties is accessed with an old-fashioned setter or
Expand Down Expand Up @@ -252,8 +234,6 @@ class in the matplotlib API, and the one you will be working with most
# y = 0
# zorder = 1
#
# .. TODO: Update these URLs
#
# The docstrings for all of the classes also contain the ``Artist``
# properties, so you can consult the interactive "help" or the
# :ref:`artist-api` for a listing of properties for a given object.
Expand Down Expand Up @@ -351,17 +331,17 @@ class in the matplotlib API, and the one you will be working with most
#
# .. TODO: Add xrefs to this table
#
# ================ ===============================================================
# Figure attribute Description
# ================ ===============================================================
# axes A list of Axes instances (includes Subplot)
# patch The Rectangle background
# images A list of FigureImages patches - useful for raw pixel display
# legends A list of Figure Legend instances (different from Axes.legends)
# lines A list of Figure Line2D instances (rarely used, see Axes.lines)
# patches A list of Figure patches (rarely used, see Axes.patches)
# texts A list Figure Text instances
# ================ ===============================================================
# ================ ======================================== C454 =======================
# Figure attribute Description
# ================ ===============================================================
# axes A list of Axes instances (includes Subplot)
# patch The Rectangle background
# images A list of FigureImages patches - useful for raw pixel display
# legends A list of Figure Legend instances (different from Axes.legends)
# lines A list of Figure Line2D instances (rarely used, see Axes.lines)
# patches A list of Figure patches (rarely used, see Axes.patches)
# texts A list Figure Text instances
# ================ ===============================================================
#
# .. _axes-container:
#
Expand Down Expand Up @@ -654,9 +634,7 @@ class in the matplotlib API, and the one you will be working with most
# to the :class:`~matplotlib.axis.Tick`. The ``Tick`` contains the tick
# and grid line instances, as well as the label instances for the upper
# and lower ticks. Each of these is accessible directly as an attribute
# of the ``Tick``. In addition, there are boolean variables that determine
# whether the upper labels and ticks are on for the x-axis and whether
# the right labels and ticks are on for the y-axis.
# of the ``Tick``.
#
# ============== ==========================================================
# Tick attribute Description
Expand All @@ -666,11 +644,6 @@ class in the matplotlib API, and the one you will be working with most
# gridline Line2D instance
# label1 Text instance
# label2 Text instance
# gridOn boolean which determines whether to draw the gridline
# tick1On boolean which determines whether to draw the 1st tickline
# tick2On boolean which determines whether to draw the 2nd tickline
# label1On boolean which determines whether to draw the 1st tick label
# label2On boolean which determines whether to draw the 2nd tick label
# ============== ==========================================================
#
# Here is an example which sets the formatter for the right side ticks with
Expand All @@ -688,8 +661,8 @@ class in the matplotlib API, and the one you will be working with most
ax.yaxis.set_major_formatter(formatter)

for tick in ax.yaxis.get_major_ticks():
tick.label1On = False
tick.label2On = True
tick.label1.set_visible(False)
tick.label2.set_visible(True)
tick.label2.set_color('green')

plt.show()
0