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
|
.. _whats-new-1-1:
New in matplotlib 1.1
=====================
.. contents:: Table of Contents
:depth: 2
.. note::
matplotlib 1.1 supports Python 2.4 to 2.7
Sankey Diagrams
---------------
Kevin Davies has extended Yannick Copin's original Sankey example into a module
(:mod:`~matplotlib.sankey`) and provided new examples
(:doc:`/gallery/specialty_plots/sankey_basics`,
:doc:`/gallery/specialty_plots/sankey_links`,
:doc:`/gallery/specialty_plots/sankey_rankine`).
.. figure:: ../../gallery/specialty_plots/images/sphx_glr_sankey_rankine_001.png
:target: ../../gallery/specialty_plots/sankey_rankine.html
:align: center
:scale: 50
Sankey Rankine
Animation
---------
Ryan May has written a backend-independent framework for creating
animated figures. The :mod:`~matplotlib.animation` module is intended
to replace the backend-specific examples formerly in the
:ref:`examples-index` listings. Examples using the new framework are
in :ref:`animation-examples-index`; see the entrancing :file:`double
pendulum <gallery/animation/double_pendulum_sgskip.py>` which uses
:meth:`matplotlib.animation.Animation.save` to create the movie below.
.. raw:: html
<iframe width="420" height="315" src="http://www.youtube.com/embed/32cjc6V0OZY" frameborder="0" allowfullscreen></iframe>
This should be considered as a beta release of the framework;
please try it and provide feedback.
Tight Layout
------------
A frequent issue raised by users of matplotlib is the lack of a layout
engine to nicely space out elements of the plots. While matplotlib still
adheres to the philosophy of giving users complete control over the placement
of plot elements, Jae-Joon Lee created the :mod:`~matplotlib.tight_layout`
module and introduced a new
command :func:`~matplotlib.pyplot.tight_layout`
to address the most common layout issues.
.. plot::
plt.rcParams['savefig.facecolor'] = "0.8"
plt.rcParams['figure.figsize'] = 4, 3
fig, axes_list = plt.subplots(2, 1)
for ax in axes_list.flat:
ax.set(xlabel="x-label", ylabel="y-label", title="before tight_layout")
ax.locator_params(nbins=3)
plt.show()
plt.rcParams['savefig.facecolor'] = "0.8"
plt.rcParams['figure.figsize'] = 4, 3
fig, axes_list = plt.subplots(2, 1)
for ax in axes_list.flat:
ax.set(xlabel="x-label", ylabel="y-label", title="after tight_layout")
ax.locator_params(nbins=3)
plt.tight_layout()
plt.show()
The usage of this functionality can be as simple as ::
plt.tight_layout()
and it will adjust the spacing between subplots
so that the axis labels do not overlap with neighboring subplots. A
:doc:`/tutorials/intermediate/tight_layout_guide` has been created to show how to use
this new tool.
PyQT4, PySide, and IPython
--------------------------
Gerald Storer made the Qt4 backend compatible with PySide as
well as PyQT4. At present, however, PySide does not support
the PyOS_InputHook mechanism for handling gui events while
waiting for text input, so it cannot be used with the new
version 0.11 of `IPython <http://ipython.org>`__. Until this
feature appears in PySide, IPython users should use
the PyQT4 wrapper for QT4, which remains the matplotlib default.
An rcParam entry, "backend.qt4", has been added to allow users
to select PyQt4, PyQt4v2, or PySide. The latter two use the
Version 2 Qt API. In most cases, users can ignore this rcParam
variable; it is available to aid in testing, and to provide control
for users who are embedding matplotlib in a PyQt4 or PySide app.
Legend
------
Jae-Joon Lee has improved plot legends. First,
legends for complex plots such as :meth:`~matplotlib.pyplot.stem` plots
will now display correctly. Second, the 'best' placement of a legend has
been improved in the presence of NANs.
See the :doc:`/tutorials/intermediate/legend_guide` for more detailed explanation and
examples.
.. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_legend_demo_004.png
:target: ../../gallery/text_labels_and_annotations/legend_demo.html
:align: center
:scale: 50
Legend Demo4
mplot3d
-------
In continuing the efforts to make 3D plotting in matplotlib just as easy
as 2D plotting, Ben Root has made several improvements to the
:mod:`~mpl_toolkits.mplot3d` module.
* :class:`~mpl_toolkits.mplot3d.axes3d.Axes3D` has been
improved to bring the class towards feature-parity with regular
Axes objects
* Documentation for :ref:`toolkit_mplot3d-tutorial` was significantly expanded
* Axis labels and orientation improved
* Most 3D plotting functions now support empty inputs
* Ticker offset display added:
.. figure:: ../../gallery/mplot3d/images/sphx_glr_offset_001.png
:target: ../../gallery/mplot3d/offset.html
:align: center
:scale: 50
Offset
* :meth:`~mpl_toolkits.mplot3d.axes3d.Axes3D.contourf`
gains *zdir* and *offset* kwargs. You can now do this:
.. figure:: ../../gallery/mplot3d/images/sphx_glr_contourf3d_2_001.png
:target: ../../gallery/mplot3d/contourf3d_2.html
:align: center
:scale: 50
Contourf3d 2
Numerix support removed
-----------------------
After more than two years of deprecation warnings, Numerix support has
now been completely removed from matplotlib.
Markers
-------
The list of available markers for :meth:`~matplotlib.pyplot.plot` and
:meth:`~matplotlib.pyplot.scatter` has now been merged. While they
were mostly similar, some markers existed for one function, but not
the other. This merge did result in a conflict for the 'd' diamond
marker. Now, 'd' will be interpreted to always mean "thin" diamond
while 'D' will mean "regular" diamond.
Thanks to Michael Droettboom for this effort.
Other improvements
------------------
* Unit support for polar axes and :func:`~matplotlib.axes.Axes.arrow`
* :class:`~matplotlib.projections.polar.PolarAxes` gains getters and setters for
"theta_direction", and "theta_offset" to allow for theta to go in
either the clock-wise or counter-clockwise direction and to specify where zero
degrees should be placed.
:meth:`~matplotlib.projections.polar.PolarAxes.set_theta_zero_location` is an
added convenience function.
* Fixed error in argument handling for tri-functions such as
:meth:`~matplotlib.pyplot.tripcolor`
* ``axes.labelweight`` parameter added to rcParams.
* For :meth:`~matplotlib.pyplot.imshow`, *interpolation='nearest'* will
now always perform an interpolation. A "none" option has been added to
indicate no interpolation at all.
* An error in the Hammer projection has been fixed.
* *clabel* for :meth:`~matplotlib.pyplot.contour` now accepts a callable.
Thanks to Daniel Hyams for the original patch.
* Jae-Joon Lee added the :class:`~mpl_toolkits.axes_grid1.axes_divider.HBox`
and :class:`~mpl_toolkits.axes_grid1.axes_divider.VBox` classes.
* Christoph Gohlke reduced memory usage in :meth:`~matplotlib.pyplot.imshow`.
* :meth:`~matplotlib.pyplot.scatter` now accepts empty inputs.
* The behavior for 'symlog' scale has been fixed, but this may result
in some minor changes to existing plots. This work was refined by
ssyr.
* Peter Butterworth added named figure support to
:func:`~matplotlib.pyplot.figure`.
* Michiel de Hoon has modified the MacOSX backend to make
its interactive behavior consistent with the other backends.
* Pim Schellart added a new colormap called "cubehelix".
Sameer Grover also added a colormap called "coolwarm". See it and all
other colormaps :ref:`here <color-colormaps_reference>`.
* Many bug fixes and documentation improvements.
|