Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History
231 lines (160 loc) · 7.39 KB

File metadata and controls

231 lines (160 loc) · 7.39 KB

New in matplotlib 1.1

Note

matplotlib 1.1 supports Python 2.4 to 2.7

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`).

../../gallery/specialty_plots/images/sphx_glr_sankey_rankine_001.png

Sankey Rankine

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.

This should be considered as a beta release of the framework; please try it and provide feedback.

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.

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. 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.

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.

../../gallery/text_labels_and_annotations/images/sphx_glr_legend_demo_004.png

Legend Demo4

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.

../../gallery/mplot3d/images/sphx_glr_offset_001.png

Offset

../../gallery/mplot3d/images/sphx_glr_contourf3d_2_001.png

Contourf3d 2

After more than two years of deprecation warnings, Numerix support has now been completely removed from matplotlib.

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.