44
44
45
45
import matplotlib.pyplot as plt
46
46
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
48
48
49
49
The :class:`~matplotlib.axes.Axes` is probably the most important
50
50
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
117
117
:class:`~matplotlib.axis.YAxis` instance, which handle the layout and
118
118
drawing of the ticks, tick labels and axis labels.
119
119
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
-
138
120
Try creating the figure below.
139
121
"""
140
122
@@ -186,7 +168,7 @@ class in the matplotlib API, and the one you will be working with most
186
168
# ========== ================================================================================
187
169
# Property Description
188
170
# ========== ================================================================================
189
- # alpha The transparency - a scalar from 0-1
171
+ # alpha The transparency - a scalar from 0-1
190
172
# animated A boolean that is used to facilitate animated drawing
191
173
# axes The axes that the Artist lives in, possibly None
192
174
# 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
199
181
# transform The transformation
200
182
# visible A boolean whether the artist should be drawn
201
183
# 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)
203
185
# ========== ================================================================================
204
186
#
205
187
# 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
252
234
# y = 0
253
235
# zorder = 1
254
236
#
255
- # .. TODO: Update these URLs
256
- #
257
237
# The docstrings for all of the classes also contain the ``Artist``
258
238
# properties, so you can consult the interactive "help" or the
259
239
# :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
351
331
#
352
332
# .. TODO: Add xrefs to this table
353
333
#
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
+ # ================ ===============================================================
365
345
#
366
346
# .. _axes-container:
367
347
#
@@ -654,9 +634,7 @@ class in the matplotlib API, and the one you will be working with most
654
634
# to the :class:`~matplotlib.axis.Tick`. The ``Tick`` contains the tick
655
635
# and grid line instances, as well as the label instances for the upper
656
636
# 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``.
660
638
#
661
639
# ============== ==========================================================
662
640
# Tick attribute Description
@@ -666,11 +644,6 @@ class in the matplotlib API, and the one you will be working with most
666
644
# gridline Line2D instance
667
645
# label1 Text instance
668
646
# 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
674
647
# ============== ==========================================================
675
648
#
676
649
# 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
688
661
ax .yaxis .set_major_formatter (formatter )
689
662
690
663
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 )
693
666
tick .label2 .set_color ('green' )
694
667
695
668
plt .show ()
0 commit comments