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
4949The :class:`~matplotlib.axes.Axes` is probably the most important
5050class 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
118118drawing 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-
138120Try 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
688661ax .yaxis .set_major_formatter (formatter )
689662
690663for 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
695668plt .show ()
0 commit comments