-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathapi_changes.txt
More file actions
1879 lines (1390 loc) · 74.9 KB
/
api_changes.txt
File metadata and controls
1879 lines (1390 loc) · 74.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
===========
API Changes
===========
This chapter is a log of changes to matplotlib that affect the
outward-facing API. If updating matplotlib breaks your scripts, this
list may help describe what changes may be necessary in your code or
help figure out possible sources of the changes you are experiencing.
For new features that were added to matplotlib, please see
:ref:`whats-new`.
Changes in 1.2.x
================
* The ``classic`` option of the rc parameter ``toolbar`` is deprecated
and will be removed in the next release.
* The :meth:`~matplotlib.cbook.isvector` method has been removed since it
is no longer functional.
* The `rasterization_zorder` property on `~matplotlib.axes.Axes` a
zorder below which artists are rasterized. This has defaulted to
-30000.0, but it now defaults to `None`, meaning no artists will be
rasterized. In order to rasterize artists below a given zorder
value, `set_rasterization_zorder` must be explicitly called.
* In :meth:`~matplotlib.axes.Axes.scatter`, and `~pyplot.scatter`,
when specifying a marker using a tuple, the angle is now specified
in degrees, not radians.
* Using :meth:`~matplotlib.axes.Axes.twinx` or
:meth:`~matplotlib.axes.Axes.twiny` no longer overrides the current locaters
and formatters on the axes.
* In :meth:`~matplotlib.axes.Axes.contourf`, the handling of the *extend*
kwarg has changed. Formerly, the extended ranges were mapped
after to 0, 1 after being normed, so that they always corresponded
to the extreme values of the colormap. Now they are mapped
outside this range so that they correspond to the special
colormap values determined by the
:meth:`~matplotlib.colors.Colormap.set_under` and
:meth:`~matplotlib.colors.Colormap.set_over` methods, which
default to the colormap end points.
* The new rc parameter ``savefig.format`` replaces ``cairo.format`` and
``savefig.extension``, and sets the default file format used by
:meth:`matplotlib.figure.Figure.savefig`.
* In :meth:`~matplotlib.pyplot.pie` and :meth:`~matplotlib.Axes.pie`, one can
now set the radius of the pie; setting the *radius* to 'None' (the default
value), will result in a pie with a radius of 1 as before.
* Use of :func:`~matplotlib.projections.projection_factory` is now deprecated
in favour of axes class identification using
:func:`~matplotlib.projections.process_projection_requirements` followed by
direct axes class invocation (at the time of writing, functions which do this
are: :meth:`~matplotlib.figure.Figure.add_axes`,
:meth:`~matplotlib.figure.Figure.add_subplot` and
:meth:`~matplotlib.figure.Figure.gca`). Therefore::
key = figure._make_key(*args, **kwargs)
ispolar = kwargs.pop('polar', False)
projection = kwargs.pop('projection', None)
if ispolar:
if projection is not None and projection != 'polar':
raise ValuError('polar and projection args are inconsistent')
projection = 'polar'
ax = projection_factory(projection, self, rect, **kwargs)
key = self._make_key(*args, **kwargs)
# is now
projection_class, kwargs, key = \
process_projection_requirements(self, *args, **kwargs)
ax = projection_class(self, rect, **kwargs)
This change means that third party objects can expose themselves as
matplotlib axes by providing a ``_as_mpl_axes`` method. See
:ref:`adding-new-scales` for more detail.
* A new keyword *extendfrac* in :meth:`~matplotlib.pyplot.colorbar` and
:class:`~matplotlib.colorbar.ColorbarBase` allows one to control the size of
the triangular minimum and maximum extensions on colorbars.
* A new keyword *capthick* in :meth:`~matplotlib.pyplot.errorbar` has been
added as an intuitive alias to the *markeredgewidth* and *mew* keyword
arguments, which indirectly controlled the thickness of the caps on
the errorbars. For backwards compatibility, specifying either of the
original keyword arguments will override any value provided by
*capthick*.
* Transform subclassing behaviour is now subtly changed. If your transform
implements a non-affine transformation, then it should override the
``transform_non_affine`` method, rather than the generic ``transform`` method.
Previously transforms would define ``transform`` and then copy the
method into ``transform_non_affine``::
class MyTransform(mtrans.Transform):
def transform(self, xy):
...
transform_non_affine = transform
This approach will no longer function correctly and should be changed to::
class MyTransform(mtrans.Transform):
def transform_non_affine(self, xy):
...
* Artists no longer have ``x_isdata`` or ``y_isdata`` attributes; instead
any artist's transform can be interrogated with
``artist_instance.get_transform().contains_branch(ax.transData)``
* Lines added to an axes now take into account their transform when updating the
data and view limits. This means transforms can now be used as a pre-transform.
For instance::
>>> import matplotlib.pyplot as plt
>>> import matplotlib.transforms as mtrans
>>> ax = plt.axes()
>>> ax.plot(range(10), transform=mtrans.Affine2D().scale(10) + ax.transData)
>>> print(ax.viewLim)
Bbox('array([[ 0., 0.],\n [ 90., 90.]])')
* One can now easily get a transform which goes from one transform's coordinate
system to another, in an optimized way, using the new subtract method on a
transform. For instance, to go from data coordinates to axes coordinates::
>>> import matplotlib.pyplot as plt
>>> ax = plt.axes()
>>> data2ax = ax.transData - ax.transAxes
>>> print(ax.transData.depth, ax.transAxes.depth)
3, 1
>>> print(data2ax.depth)
2
for versions before 1.2 this could only be achieved in a sub-optimal way,
using ``ax.transData + ax.transAxes.inverted()`` (depth is a new concept,
but had it existed it would return 4 for this example).
* ``twinx`` and ``twiny`` now returns an instance of SubplotBase if
parent axes is an instance of SubplotBase.
* All Qt3-based backends are now deprecated due to the lack of py3k bindings.
Qt and QtAgg backends will continue to work in v1.2.x for py2.6
and py2.7. It is anticipated that the Qt3 support will be completely
removed for the next release.
* :class:`~matplotlib.colors.ColorConverter`,
:class:`~matplotlib.colors.Colormap` and
:class:`~matplotlib.colors.Normalize` now subclasses ``object``
* ContourSet instances no longer have a ``transform`` attribute. Instead,
access the transform with the ``get_transform`` method.
Changes in 1.1.x
================
* Added new :class:`matplotlib.sankey.Sankey` for generating Sankey diagrams.
* In :meth:`~matplotlib.pyplot.imshow`, setting *interpolation* to 'nearest'
will now always mean that the nearest-neighbor interpolation is performed.
If you want the no-op interpolation to be performed, choose 'none'.
* There were errors in how the tri-functions were handling input parameters
that had to be fixed. If your tri-plots are not working correctly anymore,
or you were working around apparent mistakes, please see issue #203 in the
github tracker. When in doubt, use kwargs.
* The 'symlog' scale had some bad behavior in previous versions. This has now
been fixed and users should now be able to use it without frustrations.
The fixes did result in some minor changes in appearance for some users who
may have been depending on the bad behavior.
* There is now a common set of markers for all plotting functions. Previously,
some markers existed only for :meth:`~matplotlib.pyplot.scatter` or just for
:meth:`~matplotlib.pyplot.plot`. This is now no longer the case. This merge
did result in a conflict. The string 'd' now means "thin diamond" while
'D' will mean "regular diamond".
Changes beyond 0.99.x
=====================
* The default behavior of :meth:`matplotlib.axes.Axes.set_xlim`,
:meth:`matplotlib.axes.Axes.set_ylim`, and
:meth:`matplotlib.axes.Axes.axis`, and their corresponding
pyplot functions, has been changed: when view limits are
set explicitly with one of these methods, autoscaling is turned
off for the matching axis. A new *auto* kwarg is available to
control this behavior. The limit kwargs have been renamed to
*left* and *right* instead of *xmin* and *xmax*, and *bottom*
and *top* instead of *ymin* and *ymax*. The old names may still
be used, however.
* There are five new Axes methods with corresponding pyplot
functions to facilitate autoscaling, tick location, and tick
label formatting, and the general appearance of ticks and
tick labels:
+ :meth:`matplotlib.axes.Axes.autoscale` turns autoscaling
on or off, and applies it.
+ :meth:`matplotlib.axes.Axes.margins` sets margins used to
autoscale the :attr:`matplotlib.axes.Axes.viewLim` based on
the :attr:`matplotlib.axes.Axes.dataLim`.
+ :meth:`matplotlib.axes.Axes.locator_params` allows one to
adjust axes locator parameters such as *nbins*.
+ :meth:`matplotlib.axes.Axes.ticklabel_format` is a convenience
method for controlling the :class:`matplotlib.ticker.ScalarFormatter`
that is used by default with linear axes.
+ :meth:`matplotlib.axes.Axes.tick_params` controls direction, size,
visibility, and color of ticks and their labels.
* The :meth:`matplotlib.axes.Axes.bar` method accepts a *error_kw*
kwarg; it is a dictionary of kwargs to be passed to the
errorbar function.
* The :meth:`matplotlib.axes.Axes.hist` *color* kwarg now accepts
a sequence of color specs to match a sequence of datasets.
* The :class:`~matplotlib.collections.EllipseCollection` has been
changed in two ways:
+ There is a new *units* option, 'xy', that scales the ellipse with
the data units. This matches the :class:'~matplotlib.patches.Ellipse`
scaling.
+ The *height* and *width* kwargs have been changed to specify
the height and width, again for consistency with
:class:`~matplotlib.patches.Ellipse`, and to better match
their names; previously they specified the half-height and
half-width.
* There is a new rc parameter ``axes.color_cycle``, and the color
cycle is now independent of the rc parameter ``lines.color``.
:func:`matplotlib.Axes.set_default_color_cycle` is deprecated.
* You can now print several figures to one pdf file and modify the
document information dictionary of a pdf file. See the docstrings
of the class :class:`matplotlib.backends.backend_pdf.PdfPages` for
more information.
* Removed configobj_ and `enthought.traits`_ packages, which are only
required by the experimental traited config and are somewhat out of
date. If needed, install them independently.
.. _configobj: http://www.voidspace.org.uk/python/configobj.html
.. _`enthought.traits`: http://code.enthought.com/projects/traits
* The new rc parameter ``savefig.extension`` sets the filename extension
that is used by :meth:`matplotlib.figure.Figure.savefig` if its *fname*
argument lacks an extension.
* In an effort to simplify the backend API, all clipping rectangles
and paths are now passed in using GraphicsContext objects, even
on collections and images. Therefore::
draw_path_collection(self, master_transform, cliprect, clippath,
clippath_trans, paths, all_transforms, offsets,
offsetTrans, facecolors, edgecolors, linewidths,
linestyles, antialiaseds, urls)
# is now
draw_path_collection(self, gc, master_transform, paths, all_transforms,
offsets, offsetTrans, facecolors, edgecolors,
linewidths, linestyles, antialiaseds, urls)
draw_quad_mesh(self, master_transform, cliprect, clippath,
clippath_trans, meshWidth, meshHeight, coordinates,
offsets, offsetTrans, facecolors, antialiased,
showedges)
# is now
draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
coordinates, offsets, offsetTrans, facecolors,
antialiased, showedges)
draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None)
# is now
draw_image(self, gc, x, y, im)
* There are four new Axes methods with corresponding pyplot
functions that deal with unstructured triangular grids:
+ :meth:`matplotlib.axes.Axes.tricontour` draws contour lines
on a triangular grid.
+ :meth:`matplotlib.axes.Axes.tricontourf` draws filled contours
on a triangular grid.
+ :meth:`matplotlib.axes.Axes.tripcolor` draws a pseudocolor
plot on a triangular grid.
+ :meth:`matplotlib.axes.Axes.triplot` draws a triangular grid
as lines and/or markers.
Changes in 0.99
======================
* pylab no longer provides a load and save function. These are
available in matplotlib.mlab, or you can use numpy.loadtxt and
numpy.savetxt for text files, or np.save and np.load for binary
numpy arrays.
* User-generated colormaps can now be added to the set recognized
by :func:`matplotlib.cm.get_cmap`. Colormaps can be made the
default and applied to the current image using
:func:`matplotlib.pyplot.set_cmap`.
* changed use_mrecords default to False in mlab.csv2rec since this is
partially broken
* Axes instances no longer have a "frame" attribute. Instead, use the
new "spines" attribute. Spines is a dictionary where the keys are
the names of the spines (e.g. 'left','right' and so on) and the
values are the artists that draw the spines. For normal
(rectilinear) axes, these artists are Line2D instances. For other
axes (such as polar axes), these artists may be Patch instances.
* Polar plots no longer accept a resolution kwarg. Instead, each Path
must specify its own number of interpolation steps. This is
unlikely to be a user-visible change -- if interpolation of data is
required, that should be done before passing it to matplotlib.
Changes for 0.98.x
==================
* psd(), csd(), and cohere() will now automatically wrap negative
frequency components to the beginning of the returned arrays.
This is much more sensible behavior and makes them consistent
with specgram(). The previous behavior was more of an oversight
than a design decision.
* Added new keyword parameters *nonposx*, *nonposy* to
:class:`matplotlib.axes.Axes` methods that set log scale
parameters. The default is still to mask out non-positive
values, but the kwargs accept 'clip', which causes non-positive
values to be replaced with a very small positive value.
* Added new :func:`matplotlib.pyplot.fignum_exists` and
:func:`matplotlib.pyplot.get_fignums`; they merely expose
information that had been hidden in :mod:`matplotlib._pylab_helpers`.
* Deprecated numerix package.
* Added new :func:`matplotlib.image.imsave` and exposed it to the
:mod:`matplotlib.pyplot` interface.
* Remove support for pyExcelerator in exceltools -- use xlwt
instead
* Changed the defaults of acorr and xcorr to use usevlines=True,
maxlags=10 and normed=True since these are the best defaults
* Following keyword parameters for :class:`matplotlib.label.Label` are now
deprecated and new set of parameters are introduced. The new parameters
are given as a fraction of the font-size. Also, *scatteryoffsets*,
*fancybox* and *columnspacing* are added as keyword parameters.
================ ================
Deprecated New
================ ================
pad borderpad
labelsep labelspacing
handlelen handlelength
handlestextsep handletextpad
axespad borderaxespad
================ ================
* Removed the configobj and experimental traits rc support
* Modified :func:`matplotlib.mlab.psd`, :func:`matplotlib.mlab.csd`,
:func:`matplotlib.mlab.cohere`, and :func:`matplotlib.mlab.specgram`
to scale one-sided densities by a factor of 2. Also, optionally
scale the densities by the sampling frequency, which gives true values
of densities that can be integrated by the returned frequency values.
This also gives better MATLAB compatibility. The corresponding
:class:`matplotlib.axes.Axes` methods and :mod:`matplotlib.pyplot`
functions were updated as well.
* Font lookup now uses a nearest-neighbor approach rather than an
exact match. Some fonts may be different in plots, but should be
closer to what was requested.
* :meth:`matplotlib.axes.Axes.set_xlim`,
:meth:`matplotlib.axes.Axes.set_ylim` now return a copy of the
:attr:`viewlim` array to avoid modify-in-place surprises.
* :meth:`matplotlib.afm.AFM.get_fullname` and
:meth:`matplotlib.afm.AFM.get_familyname` no longer raise an
exception if the AFM file does not specify these optional
attributes, but returns a guess based on the required FontName
attribute.
* Changed precision kwarg in :func:`matplotlib.pyplot.spy`; default is
0, and the string value 'present' is used for sparse arrays only to
show filled locations.
* :class:`matplotlib.collections.EllipseCollection` added.
* Added ``angles`` kwarg to :func:`matplotlib.pyplot.quiver` for more
flexible specification of the arrow angles.
* Deprecated (raise NotImplementedError) all the mlab2 functions from
:mod:`matplotlib.mlab` out of concern that some of them were not
clean room implementations.
* Methods :meth:`matplotlib.collections.Collection.get_offsets` and
:meth:`matplotlib.collections.Collection.set_offsets` added to
:class:`~matplotlib.collections.Collection` base class.
* :attr:`matplotlib.figure.Figure.figurePatch` renamed
:attr:`matplotlib.figure.Figure.patch`;
:attr:`matplotlib.axes.Axes.axesPatch` renamed
:attr:`matplotlib.axes.Axes.patch`;
:attr:`matplotlib.axes.Axes.axesFrame` renamed
:attr:`matplotlib.axes.Axes.frame`.
:meth:`matplotlib.axes.Axes.get_frame`, which returns
:attr:`matplotlib.axes.Axes.patch`, is deprecated.
* Changes in the :class:`matplotlib.contour.ContourLabeler` attributes
(:func:`matplotlib.pyplot.clabel` function) so that they all have a
form like ``.labelAttribute``. The three attributes that are most
likely to be used by end users, ``.cl``, ``.cl_xy`` and
``.cl_cvalues`` have been maintained for the moment (in addition to
their renamed versions), but they are deprecated and will eventually
be removed.
* Moved several functions in :mod:`matplotlib.mlab` and
:mod:`matplotlib.cbook` into a separate module
:mod:`matplotlib.numerical_methods` because they were unrelated to
the initial purpose of mlab or cbook and appeared more coherent
elsewhere.
Changes for 0.98.1
==================
* Removed broken :mod:`matplotlib.axes3d` support and replaced it with
a non-implemented error pointing to 0.91.x
Changes for 0.98.0
==================
* :func:`matplotlib.image.imread` now no longer always returns RGBA data---if
the image is luminance or RGB, it will return a MxN or MxNx3 array
if possible. Also uint8 is no longer always forced to float.
* Rewrote the :class:`matplotlib.cm.ScalarMappable` callback
infrastructure to use :class:`matplotlib.cbook.CallbackRegistry`
rather than custom callback handling. Any users of
:meth:`matplotlib.cm.ScalarMappable.add_observer` of the
:class:`~matplotlib.cm.ScalarMappable` should use the
:attr:`matplotlib.cm.ScalarMappable.callbacks`
:class:`~matplotlib.cbook.CallbackRegistry` instead.
* New axes function and Axes method provide control over the plot
color cycle: :func:`matplotlib.axes.set_default_color_cycle` and
:meth:`matplotlib.axes.Axes.set_color_cycle`.
* matplotlib now requires Python 2.4, so :mod:`matplotlib.cbook` will
no longer provide :class:`set`, :func:`enumerate`, :func:`reversed`
or :func:`izip` compatibility functions.
* In Numpy 1.0, bins are specified by the left edges only. The axes
method :meth:`matplotlib.axes.Axes.hist` now uses future Numpy 1.3
semantics for histograms. Providing ``binedges``, the last value gives
the upper-right edge now, which was implicitly set to +infinity in
Numpy 1.0. This also means that the last bin doesn't contain upper
outliers any more by default.
* New axes method and pyplot function,
:func:`~matplotlib.pyplot.hexbin`, is an alternative to
:func:`~matplotlib.pyplot.scatter` for large datasets. It makes
something like a :func:`~matplotlib.pyplot.pcolor` of a 2-D
histogram, but uses hexagonal bins.
* New kwarg, ``symmetric``, in :class:`matplotlib.ticker.MaxNLocator`
allows one require an axis to be centered around zero.
* Toolkits must now be imported from ``mpl_toolkits`` (not ``matplotlib.toolkits``)
Notes about the transforms refactoring
--------------------------------------
A major new feature of the 0.98 series is a more flexible and
extensible transformation infrastructure, written in Python/Numpy
rather than a custom C extension.
The primary goal of this refactoring was to make it easier to
extend matplotlib to support new kinds of projections. This is
mostly an internal improvement, and the possible user-visible
changes it allows are yet to come.
See :mod:`matplotlib.transforms` for a description of the design of
the new transformation framework.
For efficiency, many of these functions return views into Numpy
arrays. This means that if you hold on to a reference to them,
their contents may change. If you want to store a snapshot of
their current values, use the Numpy array method copy().
The view intervals are now stored only in one place -- in the
:class:`matplotlib.axes.Axes` instance, not in the locator instances
as well. This means locators must get their limits from their
:class:`matplotlib.axis.Axis`, which in turn looks up its limits from
the :class:`~matplotlib.axes.Axes`. If a locator is used temporarily
and not assigned to an Axis or Axes, (e.g. in
:mod:`matplotlib.contour`), a dummy axis must be created to store its
bounds. Call :meth:`matplotlib.ticker.Locator.create_dummy_axis` to
do so.
The functionality of :class:`Pbox` has been merged with
:class:`~matplotlib.transforms.Bbox`. Its methods now all return
copies rather than modifying in place.
The following lists many of the simple changes necessary to update
code from the old transformation framework to the new one. In
particular, methods that return a copy are named with a verb in the
past tense, whereas methods that alter an object in place are named
with a verb in the present tense.
:mod:`matplotlib.transforms`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
:meth:`Bbox.get_bounds` :attr:`transforms.Bbox.bounds`
------------------------------------------------------------ ------------------------------------------------------------
:meth:`Bbox.width` :attr:`transforms.Bbox.width`
------------------------------------------------------------ ------------------------------------------------------------
:meth:`Bbox.height` :attr:`transforms.Bbox.height`
------------------------------------------------------------ ------------------------------------------------------------
`Bbox.intervalx().get_bounds()` :attr:`transforms.Bbox.intervalx`
`Bbox.intervalx().set_bounds()` [:attr:`Bbox.intervalx` is now a property.]
------------------------------------------------------------ ------------------------------------------------------------
`Bbox.intervaly().get_bounds()` :attr:`transforms.Bbox.intervaly`
`Bbox.intervaly().set_bounds()` [:attr:`Bbox.intervaly` is now a property.]
------------------------------------------------------------ ------------------------------------------------------------
:meth:`Bbox.xmin` :attr:`transforms.Bbox.x0` or
:attr:`transforms.Bbox.xmin` [1]_
------------------------------------------------------------ ------------------------------------------------------------
:meth:`Bbox.ymin` :attr:`transforms.Bbox.y0` or
:attr:`transforms.Bbox.ymin` [1]_
------------------------------------------------------------ ------------------------------------------------------------
:meth:`Bbox.xmax` :attr:`transforms.Bbox.x1` or
:attr:`transforms.Bbox.xmax` [1]_
------------------------------------------------------------ ------------------------------------------------------------
:meth:`Bbox.ymax` :attr:`transforms.Bbox.y1` or
:attr:`transforms.Bbox.ymax` [1]_
------------------------------------------------------------ ------------------------------------------------------------
`Bbox.overlaps(bboxes)` `Bbox.count_overlaps(bboxes)`
------------------------------------------------------------ ------------------------------------------------------------
`bbox_all(bboxes)` `Bbox.union(bboxes)`
[:meth:`transforms.Bbox.union` is a staticmethod.]
------------------------------------------------------------ ------------------------------------------------------------
`lbwh_to_bbox(l, b, w, h)` `Bbox.from_bounds(x0, y0, w, h)`
[:meth:`transforms.Bbox.from_bounds` is a staticmethod.]
------------------------------------------------------------ ------------------------------------------------------------
`inverse_transform_bbox(trans, bbox)` `Bbox.inverse_transformed(trans)`
------------------------------------------------------------ ------------------------------------------------------------
`Interval.contains_open(v)` `interval_contains_open(tuple, v)`
------------------------------------------------------------ ------------------------------------------------------------
`Interval.contains(v)` `interval_contains(tuple, v)`
------------------------------------------------------------ ------------------------------------------------------------
`identity_transform()` :class:`matplotlib.transforms.IdentityTransform`
------------------------------------------------------------ ------------------------------------------------------------
`blend_xy_sep_transform(xtrans, ytrans)` `blended_transform_factory(xtrans, ytrans)`
------------------------------------------------------------ ------------------------------------------------------------
`scale_transform(xs, ys)` `Affine2D().scale(xs[, ys])`
------------------------------------------------------------ ------------------------------------------------------------
`get_bbox_transform(boxin, boxout)` `BboxTransform(boxin, boxout)` or
`BboxTransformFrom(boxin)` or
`BboxTransformTo(boxout)`
------------------------------------------------------------ ------------------------------------------------------------
`Transform.seq_xy_tup(points)` `Transform.transform(points)`
------------------------------------------------------------ ------------------------------------------------------------
`Transform.inverse_xy_tup(points)` `Transform.inverted().transform(points)`
============================================================ ============================================================
.. [1] The :class:`~matplotlib.transforms.Bbox` is bound by the points
(x0, y0) to (x1, y1) and there is no defined order to these points,
that is, x0 is not necessarily the left edge of the box. To get
the left edge of the :class:`Bbox`, use the read-only property
:attr:`~matplotlib.transforms.Bbox.xmin`.
:mod:`matplotlib.axes`
~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`Axes.get_position()` :meth:`matplotlib.axes.Axes.get_position` [2]_
------------------------------------------------------------ ------------------------------------------------------------
`Axes.set_position()` :meth:`matplotlib.axes.Axes.set_position` [3]_
------------------------------------------------------------ ------------------------------------------------------------
`Axes.toggle_log_lineary()` :meth:`matplotlib.axes.Axes.set_yscale` [4]_
------------------------------------------------------------ ------------------------------------------------------------
`Subplot` class removed.
============================================================ ============================================================
The :class:`Polar` class has moved to :mod:`matplotlib.projections.polar`.
.. [2] :meth:`matplotlib.axes.Axes.get_position` used to return a list
of points, now it returns a :class:`matplotlib.transforms.Bbox`
instance.
.. [3] :meth:`matplotlib.axes.Axes.set_position` now accepts either
four scalars or a :class:`matplotlib.transforms.Bbox` instance.
.. [4] Since the recfactoring allows for more than two scale types
('log' or 'linear'), it no longer makes sense to have a toggle.
`Axes.toggle_log_lineary()` has been removed.
:mod:`matplotlib.artist`
~~~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`Artist.set_clip_path(path)` `Artist.set_clip_path(path, transform)` [5]_
============================================================ ============================================================
.. [5] :meth:`matplotlib.artist.Artist.set_clip_path` now accepts a
:class:`matplotlib.path.Path` instance and a
:class:`matplotlib.transforms.Transform` that will be applied to
the path immediately before clipping.
:mod:`matplotlib.collections`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`linestyle` `linestyles` [6]_
============================================================ ============================================================
.. [6] Linestyles are now treated like all other collection
attributes, i.e. a single value or multiple values may be
provided.
:mod:`matplotlib.colors`
~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`ColorConvertor.to_rgba_list(c)` `ColorConvertor.to_rgba_array(c)`
[:meth:`matplotlib.colors.ColorConvertor.to_rgba_array`
returns an Nx4 Numpy array of RGBA color quadruples.]
============================================================ ============================================================
:mod:`matplotlib.contour`
~~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`Contour._segments` :meth:`matplotlib.contour.Contour.get_paths`` [Returns a
list of :class:`matplotlib.path.Path` instances.]
============================================================ ============================================================
:mod:`matplotlib.figure`
~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`Figure.dpi.get()` / `Figure.dpi.set()` :attr:`matplotlib.figure.Figure.dpi` *(a property)*
============================================================ ============================================================
:mod:`matplotlib.patches`
~~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`Patch.get_verts()` :meth:`matplotlib.patches.Patch.get_path` [Returns a
:class:`matplotlib.path.Path` instance]
============================================================ ============================================================
:mod:`matplotlib.backend_bases`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
============================================================ ============================================================
Old method New method
============================================================ ============================================================
`GraphicsContext.set_clip_rectangle(tuple)` `GraphicsContext.set_clip_rectangle(bbox)`
------------------------------------------------------------ ------------------------------------------------------------
`GraphicsContext.get_clip_path()` `GraphicsContext.get_clip_path()` [7]_
------------------------------------------------------------ ------------------------------------------------------------
`GraphicsContext.set_clip_path()` `GraphicsContext.set_clip_path()` [8]_
============================================================ ============================================================
:class:`~matplotlib.backend_bases.RendererBase`
```````````````````````````````````````````````
New methods:
* :meth:`draw_path(self, gc, path, transform, rgbFace)
<matplotlib.backend_bases.RendererBase.draw_path>`
* :meth:`draw_markers(self, gc, marker_path, marker_trans, path,
trans, rgbFace)
<matplotlib.backend_bases.RendererBase.draw_markers`
* :meth:`draw_path_collection(self, master_transform, cliprect,
clippath, clippath_trans, paths, all_transforms, offsets,
offsetTrans, facecolors, edgecolors, linewidths, linestyles,
antialiaseds)
<matplotlib.backend_bases.RendererBase.draw_path_collection>`
*[optional]*
Changed methods:
* `draw_image(self, x, y, im, bbox)` is now
:meth:`draw_image(self, x, y, im, bbox, clippath, clippath_trans)
<matplotlib.backend_bases.RendererBase.draw_image>`
Removed methods:
* `draw_arc`
* `draw_line_collection`
* `draw_line`
* `draw_lines`
* `draw_point`
* `draw_quad_mesh`
* `draw_poly_collection`
* `draw_polygon`
* `draw_rectangle`
* `draw_regpoly_collection`
.. [7] :meth:`matplotlib.backend_bases.GraphicsContext.get_clip_path`
returns a tuple of the form (*path*, *affine_transform*), where
*path* is a :class:`matplotlib.path.Path` instance and
*affine_transform* is a :class:`matplotlib.transforms.Affine2D`
instance.
.. [8] :meth:`matplotlib.backend_bases.GraphicsContext.set_clip_path`
now only accepts a :class:`matplotlib.transforms.TransformedPath`
instance.
Changes for 0.91.2
==================
* For :func:`csv2rec`, checkrows=0 is the new default indicating all rows
will be checked for type inference
* A warning is issued when an image is drawn on log-scaled axes, since
it will not log-scale the image data.
* Moved :func:`rec2gtk` to :mod:`matplotlib.toolkits.gtktools`
* Moved :func:`rec2excel` to :mod:`matplotlib.toolkits.exceltools`
* Removed, dead/experimental ExampleInfo, Namespace and Importer
code from :mod:`matplotlib.__init__`
Changes for 0.91.1
==================
Changes for 0.91.0
==================
* Changed :func:`cbook.is_file_like` to
:func:`cbook.is_writable_file_like` and corrected behavior.
* Added ax kwarg to :func:`pyplot.colorbar` and
:meth:`Figure.colorbar` so that one can specify the axes object from
which space for the colorbar is to be taken, if one does not want to
make the colorbar axes manually.
* Changed :func:`cbook.reversed` so it yields a tuple rather than a
(index, tuple). This agrees with the python reversed builtin,
and cbook only defines reversed if python doesnt provide the
builtin.
* Made skiprows=1 the default on :func:`csv2rec`
* The gd and paint backends have been deleted.
* The errorbar method and function now accept additional kwargs
so that upper and lower limits can be indicated by capping the
bar with a caret instead of a straight line segment.
* The :mod:`matplotlib.dviread` file now has a parser for files like
psfonts.map and pdftex.map, to map TeX font names to external files.
* The file :mod:`matplotlib.type1font` contains a new class for Type 1
fonts. Currently it simply reads pfa and pfb format files and
stores the data in a way that is suitable for embedding in pdf
files. In the future the class might actually parse the font to
allow e.g. subsetting.
* :mod:`matplotlib.FT2Font` now supports :meth:`FT_Attach_File`. In
practice this can be used to read an afm file in addition to a
pfa/pfb file, to get metrics and kerning information for a Type 1
font.
* The :class:`AFM` class now supports querying CapHeight and stem
widths. The get_name_char method now has an isord kwarg like
get_width_char.
* Changed :func:`pcolor` default to shading='flat'; but as noted now in the
docstring, it is preferable to simply use the edgecolor kwarg.
* The mathtext font commands (``\cal``, ``\rm``, ``\it``, ``\tt``) now
behave as TeX does: they are in effect until the next font change
command or the end of the grouping. Therefore uses of ``$\cal{R}$``
should be changed to ``${\cal R}$``. Alternatively, you may use the
new LaTeX-style font commands (``\mathcal``, ``\mathrm``,
``\mathit``, ``\mathtt``) which do affect the following group,
eg. ``$\mathcal{R}$``.
* Text creation commands have a new default linespacing and a new
``linespacing`` kwarg, which is a multiple of the maximum vertical
extent of a line of ordinary text. The default is 1.2;
``linespacing=2`` would be like ordinary double spacing, for example.
* Changed default kwarg in
:meth:`matplotlib.colors.Normalize.__init__`` to ``clip=False``;
clipping silently defeats the purpose of the special over, under,
and bad values in the colormap, thereby leading to unexpected
behavior. The new default should reduce such surprises.
* Made the emit property of :meth:`~matplotlib.axes.Axes.set_xlim` and
:meth:`~matplotlib.axes.Axes.set_ylim` ``True`` by default; removed
the Axes custom callback handling into a 'callbacks' attribute which
is a :class:`~matplotlib.cbook.CallbackRegistry` instance. This now
supports the 'xlim_changed' and 'ylim_changed' Axes events.
Changes for 0.90.1
==================
::
The file dviread.py has a (very limited and fragile) dvi reader
for usetex support. The API might change in the future so don't
depend on it yet.
Removed deprecated support for a float value as a gray-scale;
now it must be a string, like '0.5'. Added alpha kwarg to
ColorConverter.to_rgba_list.
New method set_bounds(vmin, vmax) for formatters, locators sets
the viewInterval and dataInterval from floats.
Removed deprecated colorbar_classic.
Line2D.get_xdata and get_ydata valid_only=False kwarg is replaced
by orig=True. When True, it returns the original data, otherwise
the processed data (masked, converted)
Some modifications to the units interface.
units.ConversionInterface.tickers renamed to
units.ConversionInterface.axisinfo and it now returns a
units.AxisInfo object rather than a tuple. This will make it
easier to add axis info functionality (eg I added a default label
on this iteration) w/o having to change the tuple length and hence
the API of the client code everytime new functionality is added.
Also, units.ConversionInterface.convert_to_value is now simply
named units.ConversionInterface.convert.
Axes.errorbar uses Axes.vlines and Axes.hlines to draw its error
limits int he vertical and horizontal direction. As you'll see
in the changes below, these funcs now return a LineCollection
rather than a list of lines. The new return signature for
errorbar is ylins, caplines, errorcollections where
errorcollections is a xerrcollection, yerrcollection
Axes.vlines and Axes.hlines now create and returns a LineCollection, not a list
of lines. This is much faster. The kwarg signature has changed,
so consult the docs
MaxNLocator accepts a new Boolean kwarg ('integer') to force
ticks to integer locations.
Commands that pass an argument to the Text constructor or to
Text.set_text() now accept any object that can be converted
with '%s'. This affects xlabel(), title(), etc.
Barh now takes a **kwargs dict instead of most of the old
arguments. This helps ensure that bar and barh are kept in sync,
but as a side effect you can no longer pass e.g. color as a
positional argument.
ft2font.get_charmap() now returns a dict that maps character codes
to glyph indices (until now it was reversed)
Moved data files into lib/matplotlib so that setuptools' develop
mode works. Re-organized the mpl-data layout so that this source
structure is maintained in the installation. (I.e. the 'fonts' and
'images' sub-directories are maintained in site-packages.).
Suggest removing site-packages/matplotlib/mpl-data and
~/.matplotlib/ttffont.cache before installing
Changes for 0.90.0
==================
::
All artists now implement a "pick" method which users should not
call. Rather, set the "picker" property of any artist you want to
pick on (the epsilon distance in points for a hit test) and
register with the "pick_event" callback. See
examples/pick_event_demo.py for details
Bar, barh, and hist have "log" binary kwarg: log=True
sets the ordinate to a log scale.
Boxplot can handle a list of vectors instead of just
an array, so vectors can have different lengths.
Plot can handle 2-D x and/or y; it plots the columns.
Added linewidth kwarg to bar and barh.
Made the default Artist._transform None (rather than invoking
identity_transform for each artist only to have it overridden
later). Use artist.get_transform() rather than artist._transform,
even in derived classes, so that the default transform will be
created lazily as needed
New LogNorm subclass of Normalize added to colors.py.
All Normalize subclasses have new inverse() method, and
the __call__() method has a new clip kwarg.
Changed class names in colors.py to match convention:
normalize -> Normalize, no_norm -> NoNorm. Old names
are still available for now.
Removed obsolete pcolor_classic command and method.
Removed lineprops and markerprops from the Annotation code and
replaced them with an arrow configurable with kwarg arrowprops.
See examples/annotation_demo.py - JDH
Changes for 0.87.7
==================
::
Completely reworked the annotations API because I found the old
API cumbersome. The new design is much more legible and easy to
read. See matplotlib.text.Annotation and
examples/annotation_demo.py
markeredgecolor and markerfacecolor cannot be configured in
matplotlibrc any more. Instead, markers are generally colored
automatically based on the color of the line, unless marker colors
are explicitely set as kwargs - NN
Changed default comment character for load to '#' - JDH
math_parse_s_ft2font_svg from mathtext.py & mathtext2.py now returns
width, height, svg_elements. svg_elements is an instance of Bunch (
cmbook.py) and has the attributes svg_glyphs and svg_lines, which are both
lists.
Renderer.draw_arc now takes an additional parameter, rotation.
It specifies to draw the artist rotated in degrees anti-
clockwise. It was added for rotated ellipses.
Renamed Figure.set_figsize_inches to Figure.set_size_inches to
better match the get method, Figure.get_size_inches.
Removed the copy_bbox_transform from transforms.py; added
shallowcopy methods to all transforms. All transforms already
had deepcopy methods.
FigureManager.resize(width, height): resize the window
specified in pixels
barh: x and y args have been renamed to width and bottom
respectively, and their order has been swapped to maintain
a (position, value) order.
bar and barh: now accept kwarg 'edgecolor'.