1.. _whats-new-0-98-4:
2
3New in matplotlib 0.98.4
4========================
5
6.. contents:: Table of Contents
7   :depth: 2
8
9
10
11It's been four months since the last matplotlib release, and there are
12a lot of new features and bug-fixes.
13
14Thanks to Charlie Moad for testing and preparing the source release,
15including binaries for OS X and Windows for python 2.4 and 2.5 (2.6
16and 3.0 will not be available until numpy is available on those
17releases).  Thanks to the many developers who contributed to this
18release, with contributions from Jae-Joon Lee, Michael Droettboom,
19Ryan May, Eric Firing, Manuel Metz, Jouni K. Seppänen, Jeff Whitaker,
20Darren Dale, David Kaplan, Michiel de Hoon and many others who
21submitted patches
22
23.. _legend-refactor:
24
25Legend enhancements
26-------------------
27
28Jae-Joon has rewritten the legend class, and added support for
29multiple columns and rows, as well as fancy box drawing.  See
30:func:`~matplotlib.pyplot.legend` and
31:class:`matplotlib.legend.Legend`.
32
33.. figure:: ../../gallery/pyplots/images/sphx_glr_whats_new_98_4_legend_001.png
34   :target: ../../gallery/pyplots/whats_new_98_4_legend.html
35   :align: center
36   :scale: 50
37
38   What's New 98 4 Legend
39
40.. _fancy-annotations:
41
42Fancy annotations and arrows
43----------------------------
44
45Jae-Joon has added lots of support to annotations for drawing fancy
46boxes and connectors in annotations.  See
47:func:`~matplotlib.pyplot.annotate` and
48:class:`~matplotlib.patches.BoxStyle`,
49:class:`~matplotlib.patches.ArrowStyle`, and
50:class:`~matplotlib.patches.ConnectionStyle`.
51
52.. plot::
53
54    import matplotlib.patches as mpatch
55    import matplotlib.pyplot as plt
56
57    figheight = 4
58    fig = plt.figure(figsize=(4.5, figheight), dpi=80)
59    fontsize = 0.2 * fig.dpi
60
61    def make_boxstyles(ax):
62        styles = mpatch.BoxStyle.get_styles()
63
64        for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
65            ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename,
66                      ha="center",
67                      size=fontsize,
68                      transform=ax.transAxes,
69                      bbox=dict(boxstyle=stylename, fc="w", ec="k"))
70
71    def make_arrowstyles(ax):
72        styles = mpatch.ArrowStyle.get_styles()
73
74        ax.set_xlim(0, 4)
75        ax.set_ylim(0, figheight*2)
76
77        for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
78            y = (float(len(styles)) - 0.25 - i)  # /figheight
79            p = mpatch.Circle((3.2, y), 0.2, fc="w")
80            ax.add_patch(p)
81
82            ax.annotate(stylename, (3.2, y),
83                        (2., y),
84                        # xycoords="figure fraction", textcoords="figure fraction",
85                        ha="right", va="center",
86                        size=fontsize,
87                        arrowprops=dict(arrowstyle=stylename,
88                                        patchB=p,
89                                        shrinkA=5,
90                                        shrinkB=5,
91                                        fc="w", ec="k",
92                                        connectionstyle="arc3,rad=-0.05",
93                                        ),
94                        bbox=dict(boxstyle="square", fc="w"))
95
96        ax.xaxis.set_visible(False)
97        ax.yaxis.set_visible(False)
98
99
100    ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[])
101    make_boxstyles(ax1)
102
103    ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[])
104    make_arrowstyles(ax2)
105
106
107    plt.show()
108
109
110Native OS X backend
111-------------------
112
113Michiel de Hoon has provided a native Mac OSX backend that is almost
114completely implemented in C. The backend can therefore use Quartz
115directly and, depending on the application, can be orders of magnitude
116faster than the existing backends. In addition, no third-party
117libraries are needed other than Python and NumPy. The backend is
118interactive from the usual terminal application on Mac using regular
119Python. It hasn't been tested with ipython yet, but in principle it
120should to work there as well.  Set 'backend : macosx' in your
121matplotlibrc file, or run your script with::
122
123    > python myfile.py -dmacosx
124
125
126.. _psd-amplitude:
127
128psd amplitude scaling
129---------------------
130
131Ryan May did a lot of work to rationalize the amplitude scaling of
132:func:`~matplotlib.pyplot.psd` and friends.  See
133:doc:`/gallery/lines_bars_and_markers/psd_demo`.
134The changes should increase MATLAB
135compatibility and increase scaling options.
136
137.. _fill-between:
138
139Fill between
140------------
141
142Added a :func:`~matplotlib.pyplot.fill_between` function to make it
143easier to do shaded region plots in the presence of masked data.  You
144can pass an *x* array and a *ylower* and *yupper* array to fill
145between, and an optional *where* argument which is a logical mask
146where you want to do the filling.
147
148.. figure:: ../../gallery/pyplots/images/sphx_glr_whats_new_98_4_fill_between_001.png
149   :target: ../../gallery/pyplots/whats_new_98_4_fill_between.html
150   :align: center
151   :scale: 50
152
153   What's New 98 4 Fill Between
154
155Lots more
156---------
157
158Here are the 0.98.4 notes from the CHANGELOG::
159
160    Added mdehoon's native macosx backend from sf patch 2179017 - JDH
161
162    Removed the prints in the set_*style commands.  Return the list of
163    pretty-printed strings instead - JDH
164
165    Some of the changes Michael made to improve the output of the
166    property tables in the rest docs broke of made difficult to use
167    some of the interactive doc helpers, e.g., setp and getp.  Having all
168    the rest markup in the ipython shell also confused the docstrings.
169    I added a new rc param docstring.harcopy, to format the docstrings
170    differently for hardcopy and other use.  The ArtistInspector
171    could use a little refactoring now since there is duplication of
172    effort between the rest out put and the non-rest output - JDH
173
174    Updated spectral methods (psd, csd, etc.) to scale one-sided
175    densities by a factor of 2 and, optionally, scale all densities by
176    the sampling frequency.  This gives better MATLAB
177    compatibility. -RM
178
179    Fixed alignment of ticks in colorbars. -MGD
180
181    drop the deprecated "new" keyword of np.histogram() for numpy 1.2
182    or later.  -JJL
183
184    Fixed a bug in svg backend that new_figure_manager() ignores
185    keywords arguments such as figsize, etc. -JJL
186
187    Fixed a bug that the handlelength of the new legend class set too
188    short when numpoints=1 -JJL
189
190    Added support for data with units (e.g., dates) to
191    Axes.fill_between. -RM
192
193    Added fancybox keyword to legend. Also applied some changes for
194    better look, including baseline adjustment of the multiline texts
195    so that it is center aligned. -JJL
196
197    The transmuter classes in the patches.py are reorganized as
198    subclasses of the Style classes. A few more box and arrow styles
199    are added. -JJL
200
201    Fixed a bug in the new legend class that didn't allowed a tuple of
202    coordinate values as loc. -JJL
203
204    Improve checks for external dependencies, using subprocess
205    (instead of deprecated popen*) and distutils (for version
206    checking) - DSD
207
208    Reimplementation of the legend which supports baseline alignment,
209    multi-column, and expand mode. - JJL
210
211    Fixed histogram autoscaling bug when bins or range are given
212    explicitly (fixes Debian bug 503148) - MM
213
214    Added rcParam axes.unicode_minus which allows plain hyphen for
215    minus when False - JDH
216
217    Added scatterpoints support in Legend. patch by Erik Tollerud -
218    JJL
219
220    Fix crash in log ticking. - MGD
221
222    Added static helper method BrokenHBarCollection.span_where and
223    Axes/pyplot method fill_between.  See
224    examples/pylab/fill_between.py - JDH
225
226    Add x_isdata and y_isdata attributes to Artist instances, and use
227    them to determine whether either or both coordinates are used when
228    updating dataLim.  This is used to fix autoscaling problems that
229    had been triggered by axhline, axhspan, axvline, axvspan. - EF
230
231    Update the psd(), csd(), cohere(), and specgram() methods of Axes
232    and the csd() cohere(), and specgram() functions in mlab to be in
233    sync with the changes to psd().  In fact, under the hood, these
234    all call the same core to do computations. - RM
235
236    Add 'pad_to' and 'sides' parameters to mlab.psd() to allow
237    controlling of zero padding and returning of negative frequency
238    components, respectively.  These are added in a way that does not
239    change the API. - RM
240
241    Fix handling of c kwarg by scatter; generalize is_string_like to
242    accept numpy and numpy.ma string array scalars. - RM and EF
243
244    Fix a possible EINTR problem in dviread, which might help when
245    saving pdf files from the qt backend. - JKS
246
247    Fix bug with zoom to rectangle and twin axes - MGD
248
249    Added Jae Joon's fancy arrow, box and annotation enhancements --
250    see examples/pylab_examples/annotation_demo2.py
251
252    Autoscaling is now supported with shared axes - EF
253
254    Fixed exception in dviread that happened with Minion - JKS
255
256    set_xlim, ylim now return a copy of the viewlim array to avoid
257    modify inplace surprises
258
259    Added image thumbnail generating function
260    matplotlib.image.thumbnail.  See examples/misc/image_thumbnail.py
261    - JDH
262
263    Applied scatleg patch based on ideas and work by Erik Tollerud and
264    Jae-Joon Lee. - MM
265
266    Fixed bug in pdf backend: if you pass a file object for output
267    instead of a filename, e.g., in a wep app, we now flush the object
268    at the end. - JKS
269
270    Add path simplification support to paths with gaps. - EF
271
272    Fix problem with AFM files that don't specify the font's full name
273    or family name. - JKS
274
275    Added 'scilimits' kwarg to Axes.ticklabel_format() method, for
276    easy access to the set_powerlimits method of the major
277    ScalarFormatter. - EF
278
279    Experimental new kwarg borderpad to replace pad in legend, based
280    on suggestion by Jae-Joon Lee.  - EF
281
282    Allow spy to ignore zero values in sparse arrays, based on patch
283    by Tony Yu.  Also fixed plot to handle empty data arrays, and
284    fixed handling of markers in figlegend. - EF
285
286    Introduce drawstyles for lines. Transparently split linestyles
287    like 'steps--' into drawstyle 'steps' and linestyle '--'.  Legends
288    always use drawstyle 'default'. - MM
289
290    Fixed quiver and quiverkey bugs (failure to scale properly when
291    resizing) and added additional methods for determining the arrow
292    angles - EF
293
294    Fix polar interpolation to handle negative values of theta - MGD
295
296    Reorganized cbook and mlab methods related to numerical
297    calculations that have little to do with the goals of those two
298    modules into a separate module numerical_methods.py Also, added
299    ability to select points and stop point selection with keyboard in
300    ginput and manual contour labeling code.  Finally, fixed contour
301    labeling bug. - DMK
302
303    Fix backtick in Postscript output. - MGD
304
305    [ 2089958 ] Path simplification for vector output backends
306    Leverage the simplification code exposed through path_to_polygons
307    to simplify certain well-behaved paths in the vector backends
308    (PDF, PS and SVG).  "path.simplify" must be set to True in
309    matplotlibrc for this to work.  - MGD
310
311    Add "filled" kwarg to Path.intersects_path and
312    Path.intersects_bbox. - MGD
313
314    Changed full arrows slightly to avoid an xpdf rendering problem
315    reported by Friedrich Hagedorn. - JKS
316
317    Fix conversion of quadratic to cubic Bezier curves in PDF and PS
318    backends. Patch by Jae-Joon Lee. - JKS
319
320    Added 5-point star marker to plot command q- EF
321
322    Fix hatching in PS backend - MGD
323
324    Fix log with base 2 - MGD
325
326    Added support for bilinear interpolation in
327    NonUniformImage; patch by Gregory Lielens. - EF
328
329    Added support for multiple histograms with data of
330    different length - MM
331
332    Fix step plots with log scale - MGD
333
334    Fix masked arrays with markers in non-Agg backends - MGD
335
336    Fix clip_on kwarg so it actually works correctly - MGD
337
338    Fix locale problems in SVG backend - MGD
339
340    fix quiver so masked values are not plotted - JSW
341
342    improve interactive pan/zoom in qt4 backend on windows - DSD
343
344    Fix more bugs in NaN/inf handling.  In particular, path
345    simplification (which does not handle NaNs or infs) will be turned
346    off automatically when infs or NaNs are present.  Also masked
347    arrays are now converted to arrays with NaNs for consistent
348    handling of masks and NaNs - MGD and EF
349
350    Added support for arbitrary rasterization resolutions to the SVG
351    backend. - MW
352