Content-Length: 486146 | pFad | http://github.com/matplotlib/matplotlib/commit/

6A116C7F Merge pull request #31692 from timhoffm/doc-artist-tutorial · matplotlib/matplotlib@39c556c · GitHub
Skip to content

Commit 39c556c

Browse files
authored
Merge pull request #31692 from timhoffm/doc-artist-tutorial
DOC: Remove Tick object details from artist tutorial
2 parents a94275a + 69be02c commit 39c556c

1 file changed

Lines changed: 10 additions & 100 deletions

File tree

galleries/tutorials/artists.py

Lines changed: 10 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -590,40 +590,16 @@ class in the Matplotlib API, and the one you will be working with most
590590
# the ticks are placed and how they are represented as strings.
591591
#
592592
# Each ``Axis`` object contains a :attr:`~matplotlib.axis.Axis.label` attribute
593-
# (this is what :mod:`.pyplot` modifies in calls to `~.pyplot.xlabel` and
594-
# `~.pyplot.ylabel`) as well as a list of major and minor ticks. The ticks are
593+
# (this is what `~.Axes.set_xlabel` / `~.Axes.set_ylabel` modifies internally)
594+
# as well as a list of major and minor ticks. The ticks are
595595
# `.axis.XTick` and `.axis.YTick` instances, which contain the actual line and
596596
# text primitives that render the ticks and ticklabels. Because the ticks are
597-
# dynamically created as needed (e.g., when panning and zooming), you should
598-
# access the lists of major and minor ticks through their accessor methods
599-
# `.axis.Axis.get_major_ticks` and `.axis.Axis.get_minor_ticks`. Although
600-
# the ticks contain all the primitives and will be covered below, ``Axis``
601-
# instances have accessor methods that return the tick lines, tick labels, tick
602-
# locations etc.:
603-
604-
fig, ax = plt.subplots()
605-
axis = ax.xaxis
606-
axis.get_ticklocs()
607-
608-
# %%
609-
610-
axis.get_ticklabels()
611-
612-
# %%
613-
# note there are twice as many ticklines as labels because by default there are
614-
# tick lines at the top and bottom but only tick labels below the xaxis;
615-
# however, this can be customized.
616-
617-
axis.get_ticklines()
618-
619-
# %%
620-
# And with the above methods, you only get lists of major ticks back by
621-
# default, but you can also ask for the minor ticks:
622-
623-
axis.get_ticklabels(minor=True)
624-
axis.get_ticklines(minor=True)
625-
626-
# %%
597+
# dynamically created and modified as needed (e.g., when panning and zooming),
598+
# directly working on the ticks and their parts (tick lines, tick labels, grid lines)
599+
# is discouraged. Instead, the high-level concepts tick locators, tick formatters
600+
# and style configuration via `~.Axes.tick_params` should be used. See
601+
# :ref:`user_axes_ticks` for details.
602+
#
627603
# Here is a summary of some of the useful accessor methods of the ``Axis``
628604
# (these have corresponding setters where useful, such as
629605
# :meth:`~matplotlib.axis.Axis.set_major_formatter`.)
@@ -634,82 +610,16 @@ class in the Matplotlib API, and the one you will be working with most
634610
# `~.Axis.get_scale` The scale of the Axis, e.g., 'log' or 'linear'
635611
# `~.Axis.get_view_interval` The interval instance of the Axis view limits
636612
# `~.Axis.get_data_interval` The interval instance of the Axis data limits
637-
# `~.Axis.get_gridlines` A list of grid lines for the Axis
638613
# `~.Axis.get_label` The Axis label - a `.Text` instance
639-
# `~.Axis.get_offset_text` The Axis offset text - a `.Text` instance
640-
# `~.Axis.get_ticklabels` A list of `.Text` instances -
641-
# keyword minor=True|False
642-
# `~.Axis.get_ticklines` A list of `.Line2D` instances -
643-
# keyword minor=True|False
644-
# `~.Axis.get_ticklocs` A list of Tick locations -
645-
# keyword minor=True|False
646614
# `~.Axis.get_major_locator` The `.ticker.Locator` instance for major ticks
647615
# `~.Axis.get_major_formatter` The `.ticker.Formatter` instance for major
648616
# ticks
649617
# `~.Axis.get_minor_locator` The `.ticker.Locator` instance for minor ticks
650618
# `~.Axis.get_minor_formatter` The `.ticker.Formatter` instance for minor
651619
# ticks
652-
# `~.axis.Axis.get_major_ticks` A list of `.Tick` instances for major ticks
653-
# `~.axis.Axis.get_minor_ticks` A list of `.Tick` instances for minor ticks
620+
# `~.Axis.get_tick_params` Styling of ticks, ticklabels and gridlines
654621
# `~.Axis.grid` Turn the grid on or off for the major or minor
655622
# ticks
656623
# ============================= ==============================================
657624
#
658-
# Here is an example, not recommended for its beauty, which customizes
659-
# the Axes and Tick properties.
660-
661-
# plt.figure creates a matplotlib.figure.Figure instance
662-
fig = plt.figure()
663-
rect = fig.patch # a rectangle instance
664-
rect.set_facecolor('lightgoldenrodyellow')
665-
666-
ax1 = fig.add_axes((0.1, 0.3, 0.4, 0.4))
667-
rect = ax1.patch
668-
rect.set_facecolor('lightslategray')
669-
670-
671-
for label in ax1.xaxis.get_ticklabels():
672-
# label is a Text instance
673-
label.set_color('red')
674-
label.set_rotation(45)
675-
label.set_fontsize(16)
676-
677-
for line in ax1.yaxis.get_ticklines():
678-
# line is a Line2D instance
679-
line.set_color('green')
680-
line.set_markersize(25)
681-
line.set_markeredgewidth(3)
682-
683-
plt.show()
684-
685-
# %%
686-
# .. _tick-container:
687-
#
688-
# Tick containers
689-
# ---------------
690-
#
691-
# The :class:`matplotlib.axis.Tick` is the final container object in our
692-
# descent from the :class:`~matplotlib.figure.Figure` to the
693-
# :class:`~matplotlib.axes.Axes` to the :class:`~matplotlib.axis.Axis`
694-
# to the :class:`~matplotlib.axis.Tick`. The ``Tick`` contains the tick
695-
# and grid line instances, as well as the label instances for the upper
696-
# and lower ticks. Each of these is accessible directly as an attribute
697-
# of the ``Tick``.
698-
#
699-
# ============== ==========================================================
700-
# Tick attribute Description
701-
# ============== ==========================================================
702-
# tick1line A `.Line2D` instance
703-
# tick2line A `.Line2D` instance
704-
# gridline A `.Line2D` instance
705-
# label1 A `.Text` instance
706-
# label2 A `.Text` instance
707-
# ============== ==========================================================
708-
#
709-
# Here is an example which sets the formatter for the right side ticks with
710-
# dollar signs and colors them green on the right side of the yaxis.
711-
#
712-
#
713-
# .. include:: ../gallery/ticks/dollar_ticks.rst
714-
# :start-after: .. redirect-from:: /gallery/pyplots/dollar_ticks
715-
# :end-before: .. admonition:: References
625+
# The full Axis API can be found at :doc:`/api/axis_api`.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/matplotlib/matplotlib/commit/

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy