1.. _whats-new-1-5:
2
3New in matplotlib 1.5
4=====================
5
6.. contents:: Table of Contents
7   :depth: 2
8
9
10.. note::
11
12   matplotlib 1.5 supports Python 2.7, 3.4, and 3.5
13
14
15
16
17
18
19Interactive OO usage
20--------------------
21
22All `.Artist`\s now keep track of if their internal state has been
23changed but not reflected in the display ('stale') by a call to
24``draw``.  It is thus possible to pragmatically determine if a given
25`.Figure` needs to be re-drawn in an interactive session.
26
27To facilitate interactive usage a ``draw_all`` method has been added
28to ``pyplot`` which will redraw all of the figures which are 'stale'.
29
30To make this convenient for interactive use matplotlib now registers
31a function either with IPython's 'post_execute' event or with the
32displayhook in the standard python REPL to automatically call
33``plt.draw_all`` just before control is returned to the REPL.  This ensures
34that the draw command is deferred and only called once.
35
36The upshot of this is that for interactive backends (including
37``%matplotlib notebook``) in interactive mode (with ``plt.ion()``)
38
39.. code-block :: python
40
41   import matplotlib.pyplot as plt
42   fig, ax = plt.subplots()
43   ln, = ax.plot([0, 1, 4, 9, 16])
44   plt.show()
45   ln.set_color('g')
46
47
48will automatically update the plot to be green.  Any subsequent
49modifications to the ``Artist`` objects will do likewise.
50
51This is the first step of a larger consolidation and simplification of
52the pyplot internals.
53
54
55Working with labeled data like pandas DataFrames
56------------------------------------------------
57Plot methods which take arrays as inputs can now also work with labeled data
58and unpack such data.
59
60This means that the following two examples produce the same plot:
61
62Example ::
63
64    df = pandas.DataFrame({"var1":[1,2,3,4,5,6], "var2":[1,2,3,4,5,6]})
65    plt.plot(df["var1"], df["var2"])
66
67
68Example ::
69
70    plt.plot("var1", "var2", data=df)
71
72This works for most plotting methods, which expect arrays/sequences as
73inputs.  ``data`` can be anything which supports ``__getitem__``
74(``dict``, ``pandas.DataFrame``, ``h5py``, ...) to access ``array`` like
75values with string keys.
76
77In addition to this, some other changes were made, which makes working with
78labeled data (ex ``pandas.Series``) easier:
79
80* For plotting methods with ``label`` keyword argument, one of the
81  data inputs is designated as the label source.  If the user does not
82  supply a ``label`` that value object will be introspected for a
83  label, currently by looking for a ``name`` attribute.  If the value
84  object does not have a ``name`` attribute but was specified by as a
85  key into the ``data`` kwarg, then the key is used.  In the above
86  examples, this results in an implicit ``label="var2"`` for both
87  cases.
88
89* ``plot()`` now uses the index of a ``Series`` instead of
90  ``np.arange(len(y))``, if no ``x`` argument is supplied.
91
92
93Added ``axes.prop_cycle`` key to rcParams
94-----------------------------------------
95
96This is a more generic form of the now-deprecated ``axes.color_cycle`` param.
97Now, we can cycle more than just colors, but also linestyles, hatches,
98and just about any other artist property. Cycler notation is used for
99defining property cycles. Adding cyclers together will be like you are
100`zip`-ing together two or more property cycles together::
101
102    axes.prop_cycle: cycler('color', 'rgb') + cycler('lw', [1, 2, 3])
103
104You can even multiply cyclers, which is like using `itertools.product`
105on two or more property cycles.
106
107.. figure:: ../../tutorials/intermediate/images/sphx_glr_color_cycle_001.png
108   :target: ../../tutorials/intermediate/color_cycle.html
109   :align: center
110   :scale: 50
111
112   Color Cycle
113
114
115New Colormaps
116-------------
117
118All four of the colormaps proposed as the new default are available
119as ``'viridis'`` (the new default in 2.0), ``'magma'``, ``'plasma'``, and
120``'inferno'``
121
122.. plot::
123
124   import numpy as np
125   from cycler import cycler
126   cmap = cycler('cmap', ['viridis', 'magma','plasma', 'inferno'])
127   x_mode = cycler('x', [1, 2])
128   y_mode = cycler('y', x_mode)
129
130   cy = (x_mode * y_mode) + cmap
131
132   def demo(ax, x, y, cmap):
133       X, Y = np.ogrid[0:2*np.pi:200j, 0:2*np.pi:200j]
134       data = np.sin(X*x) * np.cos(Y*y)
135       ax.imshow(data, interpolation='none', cmap=cmap)
136       ax.set_title(cmap)
137
138   fig, axes = plt.subplots(2, 2)
139   for ax, sty in zip(axes.ravel(), cy):
140       demo(ax, **sty)
141
142   fig.tight_layout()
143
144
145Styles
146------
147
148Several new styles have been added, including many styles from the
149Seaborn project.  Additionally, in order to prep for the upcoming 2.0
150style-change release, a 'classic' and 'default' style has been added.
151For this release, the 'default' and 'classic' styles are identical.
152By using them now in your scripts, you can help ensure a smooth
153transition during future upgrades of matplotlib, so that you can
154upgrade to the snazzy new defaults when you are ready! ::
155
156    import matplotlib.style
157    matplotlib.style.use('classic')
158
159The 'default' style will give you matplotlib's latest plotting styles::
160
161    matplotlib.style.use('default')
162
163Backends
164--------
165
166New backend selection
167`````````````````````
168
169The environment variable :envvar:`MPLBACKEND` can now be used to set the
170matplotlib backend.
171
172
173wx backend has been updated
174```````````````````````````
175
176The wx backend can now be used with both wxPython classic and
177`Phoenix <https://wxpython.org/Phoenix/docs/html/main.html>`__.
178
179wxPython classic has to be at least version 2.8.12 and works on Python 2.x. As
180of May 2015 no official release of wxPython Phoenix is available but a
181current snapshot will work on Python 2.7+ and 3.4+.
182
183If you have multiple versions of wxPython installed, then the user code is
184responsible setting the wxPython version.  How to do this is
185explained in the comment at the beginning of the example
186:doc:`/gallery/user_interfaces/embedding_in_wx2_sgskip`.
187
188Configuration (rcParams)
189------------------------
190
191Some parameters have been added, others have been improved.
192
193+---------------------------+--------------------------------------------------+
194| Parameter                 | Description                                      |
195+===========================+==================================================+
196|:rc:`xaxis.labelpad`,      | mplot3d now respects these parameters            |
197|:rc:`yaxis.labelpad`       |                                                  |
198+---------------------------+--------------------------------------------------+
199|:rc:`axes.labelpad`        | Default space between the axis and the label     |
200+---------------------------+--------------------------------------------------+
201|:rc:`errorbar.capsize`     | Default length of end caps on error bars         |
202+---------------------------+--------------------------------------------------+
203|:rc:`xtick.minor.visible`, | Default visibility of minor x/y ticks            |
204|:rc:`ytick.minor.visible`  |                                                  |
205+---------------------------+--------------------------------------------------+
206|:rc:`legend.framealpha`    | Default transparency of the legend frame box     |
207+---------------------------+--------------------------------------------------+
208|:rc:`legend.facecolor`     | Default facecolor of legend frame box (or        |
209|                           | ``'inherit'`` from :rc:`axes.facecolor`)         |
210+---------------------------+--------------------------------------------------+
211|:rc:`legend.edgecolor`     | Default edgecolor of legend frame box (or        |
212|                           | ``'inherit'`` from :rc:`axes.edgecolor`)         |
213+---------------------------+--------------------------------------------------+
214|:rc:`figure.titlesize`     | Default font size for figure suptitles           |
215+---------------------------+--------------------------------------------------+
216|:rc:`figure.titleweight`   | Default font weight for figure suptitles         |
217+---------------------------+--------------------------------------------------+
218|:rc:`image.composite_image`| Whether a vector graphics backend should         |
219|                           | composite several images into a single image or  |
220|                           | not when saving. Useful when needing to edit the |
221|                           | files further in Inkscape or other programs.     |
222+---------------------------+--------------------------------------------------+
223|:rc:`markers.fillstyle`    | Default fillstyle of markers. Possible values    |
224|                           | are ``'full'`` (the default), ``'left'``,        |
225|                           | ``'right'``, ``'bottom'``, ``'top'`` and         |
226|                           | ``'none'``                                       |
227+---------------------------+--------------------------------------------------+
228|:rc:`toolbar`              | Added ``'toolmanager'`` as a valid value,        |
229|                           | enabling the experimental ``ToolManager``        |
230|                           | feature.                                         |
231+---------------------------+--------------------------------------------------+
232
233
234Widgets
235-------
236
237Active state of Selectors
238`````````````````````````
239
240All selectors now implement ``set_active`` and ``get_active`` methods (also
241called when accessing the ``active`` property) to properly update and query
242whether they are active.
243
244
245Moved ``ignore``, ``set_active``, and ``get_active`` methods to base class ``Widget``
246`````````````````````````````````````````````````````````````````````````````````````
247
248Pushes up duplicate methods in child class to parent class to avoid duplication of code.
249
250
251Adds enable/disable feature to MultiCursor
252``````````````````````````````````````````
253
254A MultiCursor object can be disabled (and enabled) after it has been created without destroying the object.
255Example::
256
257  multi_cursor.active = False
258
259
260Improved RectangleSelector and new EllipseSelector Widget
261`````````````````````````````````````````````````````````
262
263Adds an *interactive* keyword which enables visible handles for manipulating the shape after it has been drawn.
264
265Adds keyboard modifiers for:
266
267- Moving the existing shape (default key = 'space')
268- Making the shape square (default 'shift')
269- Make the initial point the center of the shape (default 'control')
270- Square and center can be combined
271
272Allow Artists to Display Pixel Data in Cursor
273`````````````````````````````````````````````
274
275Adds `~.Artist.get_cursor_data` and `~.Artist.format_cursor_data` methods to artists
276which can be used to add zdata to the cursor display
277in the status bar.  Also adds an implementation for Images.
278
279
280New plotting features
281---------------------
282
283
284Auto-wrapping Text
285``````````````````
286
287Added the keyword argument "wrap" to Text, which automatically breaks
288long lines of text when being drawn.  Works for any rotated text,
289different modes of alignment, and for text that are either labels or
290titles.  This breaks at the ``Figure``, not ``Axes`` edge.
291
292.. plot::
293
294   fig, ax = plt.subplots()
295   fig.patch.set_color('.9')
296   ax.text(.5, .75,
297           "This is a really long string that should be wrapped so that "
298           "it does not go outside the figure.", wrap=True)
299
300Contour plot corner masking
301```````````````````````````
302
303Ian Thomas rewrote the C++ code that calculates contours to add support for
304corner masking.  This is controlled by a new keyword argument
305``corner_mask`` in the functions :func:`~matplotlib.pyplot.contour` and
306:func:`~matplotlib.pyplot.contourf`.  The previous behaviour, which is now
307obtained using ``corner_mask=False``, was for a single masked point to
308completely mask out all four quads touching that point.  The new behaviour,
309obtained using ``corner_mask=True``, only masks the corners of those
310quads touching the point; any triangular corners comprising three unmasked
311points are contoured as usual.  If the ``corner_mask`` keyword argument is not
312specified, the default value is taken from rcParams.
313
314.. figure:: ../../gallery/images_contours_and_fields/images/sphx_glr_contour_corner_mask_001.png
315   :target: ../../gallery/images_contours_and_fields/contour_corner_mask.html
316   :align: center
317   :scale: 50
318
319   Contour Corner Mask
320
321
322Mostly unified linestyles for `.Line2D`, `.Patch` and `.Collection`
323```````````````````````````````````````````````````````````````````
324
325The handling of linestyles for Lines, Patches and Collections has been
326unified.  Now they all support defining linestyles with short symbols,
327like "--", as well as with full names, like "dashed". Also the
328definition using a dash pattern (``(0., [3., 3.])``) is supported for all
329methods using `.Line2D`, `.Patch` or `.Collection`.
330
331
332Legend marker order
333```````````````````
334
335Added ability to place the label before the marker in a legend box with
336``markerfirst`` keyword
337
338
339Support for legend for PolyCollection and stackplot
340```````````````````````````````````````````````````
341
342Added a :mod:`.legend_handler` for :class:`~matplotlib.collections.PolyCollection` as well as a *labels* argument to
343:func:`~matplotlib.axes.Axes.stackplot`.
344
345
346Support for alternate pivots in mplot3d quiver plot
347```````````````````````````````````````````````````
348
349Added a :code:`pivot` kwarg to :func:`~mpl_toolkits.mplot3d.Axes3D.quiver`
350that controls the pivot point around which the quiver line rotates. This also
351determines the placement of the arrow head along the quiver line.
352
353
354Logit Scale
355```````````
356
357Added support for the 'logit' axis scale, a nonlinear transformation
358
359.. math::
360
361   x -> \log10(x / (1-x))
362
363for data between 0 and 1 excluded.
364
365
366Add step kwargs to fill_between
367```````````````````````````````
368
369Added ``step`` kwarg to `.Axes.fill_between` to allow to fill between
370lines drawn using the 'step' draw style.  The values of ``step`` match
371those of the ``where`` kwarg of `.Axes.step`.  The asymmetry of of the
372kwargs names is not ideal, but `.Axes.fill_between` already has a
373``where`` kwarg.
374
375This is particularly useful for plotting pre-binned histograms.
376
377.. figure:: ../../gallery/lines_bars_and_markers/images/sphx_glr_filled_step_001.png
378   :target: ../../gallery/lines_bars_and_markers/filled_step.html
379   :align: center
380   :scale: 50
381
382   Filled Step
383
384
385Square Plot
386```````````
387
388Implemented square plots feature as a new parameter in the axis
389function. When argument 'square' is specified, equal scaling is set,
390and the limits are set such that ``xmax-xmin == ymax-ymin``.
391
392.. plot::
393
394   fig, ax = plt.subplots()
395   ax.axis('square')
396
397
398Updated figimage to take optional resize parameter
399``````````````````````````````````````````````````
400
401Added the ability to plot simple 2D-Array using ``plt.figimage(X, resize=True)``.
402This is useful for plotting simple 2D-Array without the Axes or whitespacing
403around the image.
404
405.. plot::
406
407   data = np.random.random([500, 500])
408   plt.figimage(data, resize=True)
409
410Updated Figure.savefig() can now use figure's dpi
411`````````````````````````````````````````````````
412
413Added support to save the figure with the same dpi as the figure on the
414screen using ``dpi='figure'``:.
415
416Example::
417
418   f = plt.figure(dpi=25)  # dpi set to 25
419   S = plt.scatter([1,2,3],[4,5,6])
420   f.savefig('output.png', dpi='figure')  # output savefig dpi set to 25 (same as figure)
421
422
423Updated Table to control edge visibility
424````````````````````````````````````````
425
426Added the ability to toggle the visibility of lines in Tables.
427Functionality added to the `.pyplot.table` factory function under
428the keyword argument "edges".  Values can be the strings "open", "closed",
429"horizontal", "vertical" or combinations of the letters "L", "R", "T",
430"B" which represent left, right, top, and bottom respectively.
431
432Example::
433
434    table(..., edges="open")  # No line visible
435    table(..., edges="closed")  # All lines visible
436    table(..., edges="horizontal")  # Only top and bottom lines visible
437    table(..., edges="LT")  # Only left and top lines visible.
438
439Zero r/cstride support in plot_wireframe
440````````````````````````````````````````
441
442Adam Hughes added support to mplot3d's plot_wireframe to draw only row or
443column line plots.
444
445
446.. plot::
447
448    from mpl_toolkits.mplot3d import Axes3D, axes3d
449    fig = plt.figure()
450    ax = fig.add_subplot(111, projection='3d')
451    X, Y, Z = axes3d.get_test_data(0.05)
452    ax.plot_wireframe(X, Y, Z, rstride=10, cstride=0)
453
454
455Plot bar and barh with labels
456`````````````````````````````
457
458Added kwarg *tick_label* to `~.Axes.bar` and `~.Axes.barh` to support plotting bar graphs with a
459text label for each bar.
460
461.. plot::
462
463   plt.bar([1, 2], [.5, .75], tick_label=['bar1', 'bar2'],
464           align='center')
465
466Added center and frame kwargs to pie
467````````````````````````````````````
468
469These control where the center of the pie graph are and if
470the Axes frame is shown.
471
472Fixed 3D filled contour plot polygon rendering
473``````````````````````````````````````````````
474
475Certain cases of 3D filled contour plots that produce polygons with multiple
476holes produced improper rendering due to a loss of path information between
477:class:`~matplotlib.collections.PolyCollection` and
478:class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`.  A function
479:func:`~matplotlib.collections.PolyCollection.set_verts_and_codes` was
480added to allow path information to be retained for proper rendering.
481
482Dense colorbars are rasterized
483``````````````````````````````
484
485Vector file formats (pdf, ps, svg) are efficient for
486many types of plot element, but for some they can yield
487excessive file size and even rendering artifacts, depending
488on the renderer used for screen display.  This is a problem
489for colorbars that show a large number of shades, as is
490most commonly the case.  Now, if a colorbar is showing
49150 or more colors, it will be rasterized in vector
492backends.
493
494
495DateFormatter strftime
496``````````````````````
497:class:`~matplotlib.dates.DateFormatter`\ 's
498:meth:`~matplotlib.dates.DateFormatter.__call__` method will format
499a :class:`datetime.datetime` object with the format string passed to
500the formatter's constructor. This method accepts datetimes with years
501before 1900, unlike :meth:`datetime.datetime.strftime`.
502
503
504Artist-level {get,set}_usetex for text
505``````````````````````````````````````
506
507Add ``{get,set}_usetex`` methods to :class:`~matplotlib.text.Text` objects
508which allow artist-level control of LaTeX rendering vs. the internal mathtex
509rendering.
510
511
512``Axes.remove()`` works as expected
513```````````````````````````````````
514
515As with artists added to an :class:`~matplotlib.axes.Axes`,
516`~.axes.Axes` objects can be removed from their figure via
517`~.Artist.remove()`.
518
519
520API Consistency fix within Locators set_params() function
521`````````````````````````````````````````````````````````
522
523:meth:`~matplotlib.ticker.Locator.set_params` function, which sets parameters
524within a :class:`~matplotlib.ticker.Locator` type
525instance, is now available to all `.Locator` types. The implementation
526also prevents unsafe usage by strictly defining the parameters that a
527user can set.
528
529To use, call ``set_params()`` on a `.Locator` instance with desired arguments:
530::
531
532    loc = matplotlib.ticker.LogLocator()
533    # Set given attributes for loc.
534    loc.set_params(numticks=8, numdecs=8, subs=[2.0], base=8)
535    # The below will error, as there is no such parameter for LogLocator
536    # named foo
537    # loc.set_params(foo='bar')
538
539
540Date Locators
541`````````````
542
543Date Locators (derived from :class:`~matplotlib.dates.DateLocator`) now
544implement the `~matplotlib.ticker.Locator.tick_values` method.
545This is expected of all Locators derived from `~matplotlib.ticker.Locator`.
546
547The Date Locators can now be used easily without creating axes ::
548
549    from datetime import datetime
550    from matplotlib.dates import YearLocator
551    t0 = datetime(2002, 10, 9, 12, 10)
552    tf = datetime(2005, 10, 9, 12, 15)
553    loc = YearLocator()
554    values = loc.tick_values(t0, tf)
555
556OffsetBoxes now support clipping
557````````````````````````````````
558
559`.Artist`\s draw onto objects of type `.OffsetBox`
560through `~.offsetbox.DrawingArea` and `~.offsetbox.TextArea`.
561The `.TextArea` calculates the required space for the text and so the
562text is always within the bounds, for this nothing has changed.
563
564However, `.DrawingArea` acts as a parent for zero or more `.Artist`\s that
565draw on it and may do so beyond the bounds. Now child `.Artist`\s can be
566clipped to the bounds of the `.DrawingArea`.
567
568
569OffsetBoxes now considered by tight_layout
570``````````````````````````````````````````
571
572When `~matplotlib.pyplot.tight_layout()` or `.Figure.tight_layout`
573or `.GridSpec.tight_layout()` is called, `.OffsetBox`\es that are
574anchored outside the axes will not get chopped out. The `.OffsetBox`\es will
575also not get overlapped by other axes in case of multiple subplots.
576
577Per-page pdf notes in multi-page pdfs (PdfPages)
578````````````````````````````````````````````````
579
580Add a new method :meth:`~matplotlib.backends.backend_pdf.PdfPages.attach_note`
581to the PdfPages class, allowing the
582attachment of simple text notes to pages in a multi-page pdf of
583figures. The new note is visible in the list of pdf annotations in a
584viewer that has this facility (Adobe Reader, OSX Preview, Skim,
585etc.). Per default the note itself is kept off-page to prevent it to
586appear in print-outs.
587
588`.PdfPages.attach_note` needs to be called before `~.Figure.savefig` in order to be
589added to the correct figure.
590
591Updated fignum_exists to take figure name
592`````````````````````````````````````````
593
594Added the ability to check the existence of a figure using its name
595instead of just the figure number.
596Example::
597
598  figure('figure')
599  fignum_exists('figure') #true
600
601
602ToolManager
603-----------
604
605Federico Ariza wrote the new `~matplotlib.backend_managers.ToolManager`
606that comes as replacement for `.NavigationToolbar2`
607
608`.ToolManager` offers a new way of looking at the user interactions
609with the figures.  Before we had the `.NavigationToolbar2` with its own
610tools like ``zoom/pan/home/save/...`` and also we had the shortcuts like
611``yscale/grid/quit/....``. `.ToolManager` relocate all those actions as
612`Tools` (located in `~matplotlib.backend_tools`), and defines a way to
613access/trigger/reconfigure them.
614
615The `Toolbars` are replaced for `ToolContainers` that are just GUI
616interfaces to `trigger` the tools. But don't worry the default
617backends include a `ToolContainer` called `toolbar`
618
619
620.. note::
621    At the moment, we release this primarily for feedback purposes and should
622    be treated as experimental until further notice as API changes will occur.
623    For the moment the `.ToolManager` works only with the GTK3 and Tk backends.
624    Make sure you use one of those.
625    Port for the rest of the backends is coming soon.
626
627    To activate the `.ToolManager` include the following at the top of your file ::
628
629      >>> matplotlib.rcParams['toolbar'] = 'toolmanager'
630
631
632Interact with the ToolContainer
633```````````````````````````````
634
635The most important feature is the ability to easily reconfigure the ToolContainer (aka toolbar).
636For example, if we want to remove the "forward" button we would just do. ::
637
638 >>> fig.canvas.manager.toolmanager.remove_tool('forward')
639
640Now if you want to programmatically trigger the "home" button ::
641
642 >>> fig.canvas.manager.toolmanager.trigger_tool('home')
643
644
645New Tools for ToolManager
646`````````````````````````
647
648It is possible to add new tools to the ToolManager
649
650A very simple tool that prints "You're awesome" would be::
651
652    from matplotlib.backend_tools import ToolBase
653    class AwesomeTool(ToolBase):
654        def trigger(self, *args, **kwargs):
655            print("You're awesome")
656
657
658To add this tool to `.ToolManager`
659
660 >>> fig.canvas.manager.toolmanager.add_tool('Awesome', AwesomeTool)
661
662If we want to add a shortcut ("d") for the tool
663
664 >>> fig.canvas.manager.toolmanager.update_keymap('Awesome', 'd')
665
666
667To add it to the toolbar inside the group 'foo'
668
669 >>> fig.canvas.manager.toolbar.add_tool('Awesome', 'foo')
670
671
672There is a second class of tools, "Toggleable Tools", this are almost
673the same as our basic tools, just that belong to a group, and are
674mutually exclusive inside that group.  For tools derived from
675`.ToolToggleBase` there are two basic methods `~.ToolToggleBase.enable` and `~.ToolToggleBase.disable`
676that are called automatically whenever it is toggled.
677
678
679A full example is located in :doc:`/gallery/user_interfaces/toolmanager_sgskip`
680
681
682cbook.is_sequence_of_strings recognizes string objects
683------------------------------------------------------
684
685This is primarily how pandas stores a sequence of strings ::
686
687    import pandas as pd
688    import matplotlib.cbook as cbook
689
690    a = np.array(['a', 'b', 'c'])
691    print(cbook.is_sequence_of_strings(a))  # True
692
693    a = np.array(['a', 'b', 'c'], dtype=object)
694    print(cbook.is_sequence_of_strings(a))  # True
695
696    s = pd.Series(['a', 'b', 'c'])
697    print(cbook.is_sequence_of_strings(s))  # True
698
699Previously, the last two prints returned false.
700
701
702New ``close-figs`` argument for plot directive
703----------------------------------------------
704
705Matplotlib has a sphinx extension ``plot_directive`` that creates plots for
706inclusion in sphinx documents.  Matplotlib 1.5 adds a new option to the plot
707directive - ``close-figs`` - that closes any previous figure windows before
708creating the plots.  This can help avoid some surprising duplicates of plots
709when using ``plot_directive``.
710
711Support for URL string arguments to ``imread``
712----------------------------------------------
713
714The :func:`~matplotlib.pyplot.imread` function now accepts URL strings that
715point to remote PNG files. This circumvents the generation of a
716HTTPResponse object directly.
717
718Display hook for animations in the IPython notebook
719---------------------------------------------------
720
721`~matplotlib.animation.Animation` instances gained a ``_repr_html_`` method
722to support inline display of animations in the notebook. The method used
723to display is controlled by the ``animation.html`` rc parameter, which
724currently supports values of ``none`` and ``html5``. ``none`` is the
725default, performing no display. ``html5`` converts the animation to an
726h264 encoded video, which is embedded directly in the notebook.
727
728Users not wishing to use the ``_repr_html_`` display hook can also manually
729call the `to_html5_video` method to get the HTML and display using
730IPython's ``HTML`` display class::
731
732    from IPython.display import HTML
733    HTML(anim.to_html5_video())
734
735Prefixed pkg-config for building
736--------------------------------
737
738Handling of pkg-config has been fixed in so far as it is now possible to set it
739using the environment variable ``PKG_CONFIG``. This is important if your
740toolchain is prefixed. This is done in a simpilar way as setting ``CC``
741or ``CXX`` before building. An example follows.
742
743    export PKG_CONFIG=x86_64-pc-linux-gnu-pkg-config
744