@@ -91,10 +91,10 @@ class in the matplotlib API, and the one you will be working with most
91
91
.. sourcecode:: ipython
8000
92
92
93
93
In [101]: ax.lines[0]
94
- Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
94
+ Out[101]: <matplotlib.lines.Line2D at 0x19a95710>
95
95
96
96
In [102]: line
97
- Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710>
97
+ Out[102]: <matplotlib.lines.Line2D at 0x19a95710>
98
98
99
99
If you make subsequent calls to ``ax.plot`` (and the hold state is "on"
100
100
which is the default) then additional lines will be added to the list.
@@ -107,7 +107,7 @@ class in the matplotlib API, and the one you will be working with most
107
107
The Axes also has helper methods to configure and decorate the x-axis
108
108
and y-axis tick, tick labels and axis labels::
109
109
110
- xtext = ax.set_xlabel('my xdata') # returns a Text instance
110
+ xtext = ax.set_xlabel('my xdata') # returns a Text instance
111
111
ytext = ax.set_ylabel('my ydata')
112
112
113
113
When you call :meth:`ax.set_xlabel <matplotlib.axes.Axes.set_xlabel>`,
@@ -149,20 +149,20 @@ class in the matplotlib API, and the one you will be working with most
149
149
# Customizing your objects
150
150
# ========================
151
8000
td>151
#
152
- # Every element in the figure is represented by a matplotlib
152
+ # Every element in the figure is represented by a Matplotlib
153
153
# :class:`~matplotlib.artist.Artist`, and each has an extensive list of
154
154
# properties to configure its appearance. The figure itself contains a
155
155
# :class:`~matplotlib.patches.Rectangle` exactly the size of the figure,
156
156
# which you can use to set the background color and transparency of the
157
157
# figures. Likewise, each :class:`~matplotlib.axes.Axes` bounding box
158
- # (the standard white box with black edges in the typical matplotlib
158
+ # (the standard white box with black edges in the typical Matplotlib
159
159
# plot, has a ``Rectangle`` instance that determines the color,
160
160
# transparency, and other properties of the Axes. These instances are
161
161
# stored as member variables :attr:`Figure.patch
162
162
# <matplotlib.figure.Figure.patch>` and :attr:`Axes.patch
163
163
# <matplotlib.axes.Axes.patch>` ("Patch" is a name inherited from
164
164
# MATLAB, and is a 2D "patch" of color on the figure, e.g., rectangles,
165
- # circles and polygons). Every matplotlib ``Artist`` has the following
165
+ # circles and polygons). Every Matplotlib ``Artist`` has the following
166
166
# properties
167
167
#
168
168
# ========== =================================================================
@@ -210,31 +210,49 @@ class in the matplotlib API, and the one you will be working with most
210
210
# .. sourcecode:: ipython
211
211
#
212
212
# In [149]: matplotlib.artist.getp(fig.patch)
213
- # alpha = 1.0
214
- # animated = False
215
- # antialiased or aa = True
216
- # axes = None
217
- # clip_box = None
218
- # clip_on = False
219
- # clip_path = None
220
- # contains = None
221
- # edgecolor or ec = w
222
- # facecolor or fc = 0.75
223
- # figure = Figure(8.125x6.125)
224
- # fill = 1
225
- # hatch = None
226
- # height = 1
227
- # label =
228
- # linewidth or lw = 1.0
229
- # picker = None
230
- # transform = <Affine object at 0x134cca84>
231
- # verts = ((0, 0), (0, 1), (1, 1), (1, 0))
232
- # visible = True
233
- # width = 1
234
- # window_extent = <Bbox object at 0x134acbcc>
235
- # x = 0
236
- # y = 0
237
- # zorder = 1
213
+ # agg_filter = None
214
+ # alpha = None
215
+ # animated = False
216
+ # antialiased or aa = False
217
+ # bbox = Bbox(x0=0.0, y0=0.0, x1=1.0, y1=1.0)
218
+ # capstyle = butt
219
+ # children = []
220
+ # clip_box = None
221
+ # clip_on = True
222
+ # clip_path = None
223
+ # contains = None
224
+ # data_transform = BboxTransformTo( TransformedBbox( Bbox...
225
+ # edgecolor or ec = (1.0, 1.0, 1.0, 1.0)
226
+ # extents = Bbox(x0=0.0, y0=0.0, x1=640.0, y1=480.0)
227
+ # facecolor or fc = (1.0, 1.0, 1.0, 1.0)
228
+ # figure = Figure(640x480)
229
+ # fill = True
230
+ # gid = None
231
+ # hatch = None
232
+ # height = 1
233
+ # in_layout = False
234
+ # joinstyle = miter
235
+ # label =
236
+ # linestyle or ls = solid
237
+ # linewidth or lw = 0.0
238
+ # patch_transform = CompositeGenericTransform( BboxTransformTo( ...
239
+ # path = Path(array([[0., 0.], [1., 0.], [1.,...
240
+ # path_effects = []
241
+ # picker = None
242
+ # rasterized = None
243
+ # sketch_params = None
244
+ # snap = None
245
+ # transform = CompositeGenericTransform( CompositeGenericTra...
246
+ # transformed_clip_path_and_affine = (None, None)
247
+ # url = None
248
+ # verts = [[ 0. 0.] [640. 0.] [640. 480.] [ 0. 480....
249
+ # visible = True
250
+ # width = 1
251
+ # window_extent = Bbox(x0=0.0, y0=0.0, x1=640.0, y1=480.0)
252
+ # x = 0
253
+ # xy = (0, 0)
254
+ # y = 0
255
+ # zorder = 1
238
256
#
239
257
# The docstrings for all of the classes also contain the ``Artist``
240
258
# properties, so you can consult the interactive "help" or the
@@ -284,11 +302,10 @@ class in the matplotlib API, and the one you will be working with most
284
302
# In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3])
285
303
#
286
304
# In [159]: ax1
287
- # Out[159]: <matplotlib.axes.Subplot instance at 0xd54b26c >
305
+ # Out[159]: <AxesSubplot: >
288
306
#
289
307
# In [160]: print(fig.axes)
290
- # [<matplotlib.axes.Subplot instance at 0xd54b26c>,
291
- # <matplotlib.axes.Axes instance at 0xd3f0b2c>]
308
+ # [<AxesSubplot:>, <matplotlib.axes._axes.Axes object at 0x7f0768702be0>]
292
309
#
293
310
# Because the figure maintains the concept of the "current axes" (see
294
311
# :meth:`Figure.gca <matplotlib.figure.Figure.gca>` and
@@ -354,7 +371,7 @@ class in the matplotlib API, and the one you will be working with most
354
371
# Axes container
355
372
# --------------
356
373
#
357
- # The :class:`matplotlib.axes.Axes` is the center of the matplotlib
374
+ # The :class:`matplotlib.axes.Axes` is the center of the Matplotlib
358
375
# universe -- it contains the vast majority of all the ``Artists`` used
359
376
# in a figure with many helper methods to create and add these
360
377
# ``Artists`` to itself, as well as helper methods to access and
@@ -391,7 +408,7 @@ class in the matplotlib API, and the one you will be working with most
391
408
# .. sourcecode:: ipython
392
409
#
393
410
# In [229]: print(ax.lines)
394
- # [<matplotlib.lines.Line2D instance at 0xd378b0c>]
411
+ # [<matplotlib.lines.Line2D at 0xd378b0c>]
395
412
#
396
413
# Similarly, methods that create patches, like
397
414
# :meth:`~matplotlib.axes.Axes.bar` creates a list of rectangles, will
@@ -403,9 +420,10 @@ class in the matplotlib API, and the one you will be working with most
403
420
# In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50)
404
421
#
405
422
# In [234]: rectangles
406
- # Out[234]: <a list of 50 Patch objects >
423
+ # Out[234]: <BarContainer object of 50 artists >
407
424
#
408
425
# In [235]: print(len(ax.patches))
426
+ # Out[235]: 50
409
427
#
410
428
# You should not add objects directly to the ``Axes.lines`` or
411
429
# ``Axes.patches`` lists unless you know exactly what you are doing,
@@ -433,8 +451,8 @@ class in the matplotlib API, and the one you will be working with most
433
451
# None
434
452
#
435
453
# # and the transformation instance is set to the "identity transform"
436
- # In [265]: print(rect.get_transform ())
437
- # <Affine object at 0x13695544>
454
+ # In [265]: print(rect.get_data_transform ())
455
+ # IdentityTransform()
438
456
#
439
457
# # now we add the Rectangle to the Axes
440
458
# In [266]: ax.add_patch(rect)
@@ -445,12 +463,56 @@ class in the matplotlib API, and the one you will be working with most
445
463
# Axes(0.125,0.1;0.775x0.8)
446
464
#
447
465
# # and the transformation has been set too
448
- # In [268]: print(rect.get_transform())
449
- # <Affine object at 0x15009ca4>
466
+ # In [268]: print(rect.get_data_transform())
467
+ # CompositeGenericTransform(
468
+ # TransformWrapper(
469
+ # BlendedAffine2D(
470
+ # IdentityTransform(),
471
+ # IdentityTransform())),
472
+ # CompositeGenericTransform(
473
+ # BboxTransformFrom(
474
+ # TransformedBbox(
475
+ # Bbox(x0=0.0, y0=0.0, x1=1.0, y1=1.0),
476
+ # TransformWrapper(
477
+ # BlendedAffine2D(
478
+ # IdentityTransform(),
479
+ # IdentityTransform())))),
480
+ # BboxTransformTo(
481
+ # TransformedBbox(
482
+ # Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),
483
+ # BboxTransformTo(
484
+ # TransformedBbox(
485
+ # Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),
486
+ # Affine2D(
487
+ # [[100. 0. 0.]
488
+ # [ 0. 100. 0.]
489
+ # [ 0. 0. 1.]])))))))
450
490
#
451
491
# # the default axes transformation is ax.transData
452
492
# In [269]: print(ax.transData)
453
- # <Affine object at 0x15009ca4>
493
+ # CompositeGenericTransform(
494
+ # TransformWrapper(
495
+ # BlendedAffine2D(
496
+ # IdentityTransform(),
497
+ # IdentityTransform())),
498
+ # CompositeGenericTransform(
499
+ # BboxTransformFrom(
500
+ # TransformedBbox(
501
+ # Bbox(x0=0.0, y0=0.0, x1=1.0, y1=1.0),
502
+ # TransformWrapper(
503
+ # BlendedAffine2D(
504
+ # IdentityTransform(),
505
+ # IdentityTransform())))),
506
+ # BboxTransformTo(
507
+ # TransformedBbox(
508
+ # Bbox(x0=0.125, y0=0.10999999999999999, x1=0.9, y1=0.88),
509
+ # BboxTransformTo(
510
+ # TransformedBbox(
511
+ # Bbox(x0=0.0, y0=0.0, x1=6.4, y1=4.8),
512
+ # Affine2D(
513
+ # [[100. 0. 0.]
514
+ # [ 0. 100. 0.]
515
+ # [ 0. 0. 1.]])))))))
454
516
#
455
517
# # notice that the xlimits of the Axes have not been changed
456
518
# In [270]: print(ax.get_xlim())
@@ -463,12 +525,12 @@ class in the matplotlib API, and the one you will be working with most
463
525
# # we can manually invoke the auto-scaling machinery
464
526
# In [272]: ax.autoscale_view()
465
527
#
466
- # # and now the xlim are updated to encompass the rectangle
528
+ # # and now the xlim are updated to encompass the rectangle, plus margins
467
529
# In [273]: print(ax.get_xlim())
468
- # (1.0 , 6.0 )
530
+ # (0.75 , 6.25 )
469
531
#
470
532
# # we have to manually force a figure draw
471
- # In [274]: ax.figure .canvas.draw()
533
+ # In [274]: fig .canvas.draw()
472
534
#
473
535
#
474
536
# There are many, many ``Axes`` helper methods for creating primitive
0 commit comments