diff --git a/doc/_templates/index.html b/doc/_templates/index.html index 1bc285acaa47..1cdc30fb58c4 100644 --- a/doc/_templates/index.html +++ b/doc/_templates/index.html @@ -160,13 +160,21 @@

Need help?

Toolkits

-

There are several matplotlib add-on toolkits, -including a choice of two projection and mapping toolkits basemap and -cartopy, -3d plotting with mplot3d, -axes and axis helpers in axes_grid and more. +

Matplotlib ships with several add-on toolkits, + Including 3d plotting with mplot3d, + axes helpers in axes_grid1 and + axis helpers in axisartist.

+

Third party packages

+ +

A large number of third party packages + extend and build on Matplotlib functionality, + including a choice of two projection and mapping toolkits + basemap and + cartopy. +

+

Citing matplotlib

diff --git a/doc/api/api_changes/2015-12-30-JHN.rst b/doc/api/api_changes/2015-12-30-JHN.rst new file mode 100644 index 000000000000..64b826c26ef7 --- /dev/null +++ b/doc/api/api_changes/2015-12-30-JHN.rst @@ -0,0 +1,7 @@ +`mpl_toolkits.axes_grid` has been deprecated +```````````````````````````````````````````` + +All functionallity from `mpl_toolkits.axes_grid` can be found in either +`mpl_toolkits.axes_grid1` or `mpl_toolkits.axisartist`. Axes classes from +`mpl_toolkits.axes_grid` based on `Axis` from `mpl_toolkits.axisartist` can be +found in `mpl_toolkits.axisartist` diff --git a/doc/conf.py b/doc/conf.py index 84221b2bce32..bc1eb0123cbc 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -135,7 +135,8 @@ ('api', 'API'), ('pylab_examples', 'pylab examples'), ('mplot3d', 'mplot3d toolkit'), - ('axes_grid', 'axes_grid toolkit'), + ('axes_grid1', 'axes_grid1 toolkit'), + ('axisartist', 'axisartist toolkit'), ('units', 'units'), ('widgets', 'widgets'), ) diff --git a/doc/contents.rst b/doc/contents.rst index 62612705ab2e..c7bacc2b6afc 100644 --- a/doc/contents.rst +++ b/doc/contents.rst @@ -18,6 +18,7 @@ Overview users/index.rst faq/index.rst resources/index.rst + thirdpartypackages/index.rst devel/index.rst mpl_toolkits/index.rst api/index.rst diff --git a/doc/make.py b/doc/make.py index 783e159be23c..78366dea3dca 100755 --- a/doc/make.py +++ b/doc/make.py @@ -149,7 +149,8 @@ def all(): required_symlinks = [ ('mpl_examples', '../examples/'), - ('mpl_toolkits/axes_grid/examples', '../../../examples/axes_grid/') + ('mpl_toolkits/axes_grid1/examples', '../../../examples/axes_grid1/'), + ('mpl_toolkits/axisartist/examples', '../../../examples/axisartist/') ] symlink_warnings = [] diff --git a/doc/mpl_toolkits/axes_grid/api/axes_divider_api.rst b/doc/mpl_toolkits/axes_grid/api/axes_divider_api.rst deleted file mode 100644 index fc090530e664..000000000000 --- a/doc/mpl_toolkits/axes_grid/api/axes_divider_api.rst +++ /dev/null @@ -1,18 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axes_divider` -========================================== - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.Divider - :members: - :undoc-members: - - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesLocator - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.SubplotDivider - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesDivider - :members: diff --git a/doc/mpl_toolkits/axes_grid/api/axes_grid_api.rst b/doc/mpl_toolkits/axes_grid/api/axes_grid_api.rst deleted file mode 100644 index 15fa8bd2a2c1..000000000000 --- a/doc/mpl_toolkits/axes_grid/api/axes_grid_api.rst +++ /dev/null @@ -1,11 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axes_grid` -======================================= - -.. autoclass:: mpl_toolkits.axes_grid.axes_grid.Grid - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axes_grid.ImageGrid - :members: - :undoc-members: diff --git a/doc/mpl_toolkits/axes_grid/api/axes_size_api.rst b/doc/mpl_toolkits/axes_grid/api/axes_size_api.rst deleted file mode 100644 index 1238bfd903b2..000000000000 --- a/doc/mpl_toolkits/axes_grid/api/axes_size_api.rst +++ /dev/null @@ -1,6 +0,0 @@ -:mod:`mpl_toolkits.axes_grid.axes_size` -======================================= - -.. automodule:: mpl_toolkits.axes_grid.axes_size - :members: Fixed, Scaled, AxesX, AxesY, MaxWidth, MaxHeight, Fraction, Padded, from_any - diff --git a/doc/mpl_toolkits/axes_grid/api/axis_artist_api.rst b/doc/mpl_toolkits/axes_grid/api/axis_artist_api.rst deleted file mode 100644 index f18a52daab65..000000000000 --- a/doc/mpl_toolkits/axes_grid/api/axis_artist_api.rst +++ /dev/null @@ -1,16 +0,0 @@ - -:mod:`mpl_toolkits.axes_grid.axis_artist` -========================================= - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.AxisArtist - :members: - :undoc-members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.Ticks - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.AxisLabel - :members: - -.. autoclass:: mpl_toolkits.axes_grid.axis_artist.TickLabels - :members: diff --git a/doc/mpl_toolkits/axes_grid/examples b/doc/mpl_toolkits/axes_grid/examples deleted file mode 120000 index 69ba136bcc62..000000000000 --- a/doc/mpl_toolkits/axes_grid/examples +++ /dev/null @@ -1 +0,0 @@ -../../../examples/axes_grid/ \ No newline at end of file diff --git a/doc/mpl_toolkits/axes_grid/index.rst b/doc/mpl_toolkits/axes_grid/index.rst deleted file mode 100644 index 90f223c8436a..000000000000 --- a/doc/mpl_toolkits/axes_grid/index.rst +++ /dev/null @@ -1,36 +0,0 @@ - -.. _toolkit_axesgrid-index: - -Matplotlib AxesGrid Toolkit -=========================== - -The matplotlib AxesGrid toolkit is a collection of helper classes to -ease displaying multiple images in matplotlib. While the aspect -parameter in matplotlib adjust the position of the single axes, -AxesGrid toolkit provides a framework to adjust the position of -multiple axes according to their aspects. - - -.. image:: ../../_static/demo_axes_grid.png - -.. note:: - AxesGrid toolkit has been a part of matplotlib since v - 0.99. Originally, the toolkit had a single namespace of - *axes_grid*. In more recent version (since svn r8226), the toolkit - has divided into two separate namespace (*axes_grid1* and *axisartist*). - While *axes_grid* namespace is maintained for the backward compatibility, - use of *axes_grid1* and *axisartist* is recommended. - -.. warning:: - *axes_grid* and *axisartist* (but not *axes_grid1*) uses - a custom Axes class (derived from the mpl's original Axes class). - As a side effect, some commands (mostly tick-related) do not work. - Use *axes_grid1* to avoid this, or see how things are different in - *axes_grid* and *axisartist* (LINK needed) - -.. toctree:: - :maxdepth: 2 - - users/overview.rst - users/index.rst - api/index.rst diff --git a/doc/mpl_toolkits/axes_grid/api/anchored_artists_api.rst b/doc/mpl_toolkits/axes_grid1/api/anchored_artists_api.rst similarity index 100% rename from doc/mpl_toolkits/axes_grid/api/anchored_artists_api.rst rename to doc/mpl_toolkits/axes_grid1/api/anchored_artists_api.rst diff --git a/doc/mpl_toolkits/axes_grid1/api/axes_divider_api.rst b/doc/mpl_toolkits/axes_grid1/api/axes_divider_api.rst new file mode 100644 index 000000000000..df3610d680ed --- /dev/null +++ b/doc/mpl_toolkits/axes_grid1/api/axes_divider_api.rst @@ -0,0 +1,18 @@ + +:mod:`mpl_toolkits.axes_grid1.axes_divider` +=========================================== + +.. autoclass:: mpl_toolkits.axes_grid1.axes_divider.Divider + :members: + :undoc-members: + + +.. autoclass:: mpl_toolkits.axes_grid1.axes_divider.AxesLocator + :members: + :undoc-members: + +.. autoclass:: mpl_toolkits.axes_grid1.axes_divider.SubplotDivider + :members: + +.. autoclass:: mpl_toolkits.axes_grid1.axes_divider.AxesDivider + :members: diff --git a/doc/mpl_toolkits/axes_grid1/api/axes_grid_api.rst b/doc/mpl_toolkits/axes_grid1/api/axes_grid_api.rst new file mode 100644 index 000000000000..c52efc8ff102 --- /dev/null +++ b/doc/mpl_toolkits/axes_grid1/api/axes_grid_api.rst @@ -0,0 +1,11 @@ + +:mod:`mpl_toolkits.axes_grid1.axes_grid` +======================================== + +.. autoclass:: mpl_toolkits.axes_grid1.axes_grid.Grid + :members: + :undoc-members: + +.. autoclass:: mpl_toolkits.axes_grid1.axes_grid.ImageGrid + :members: + :undoc-members: diff --git a/doc/mpl_toolkits/axes_grid1/api/axes_size_api.rst b/doc/mpl_toolkits/axes_grid1/api/axes_size_api.rst new file mode 100644 index 000000000000..06a0b053a9f2 --- /dev/null +++ b/doc/mpl_toolkits/axes_grid1/api/axes_size_api.rst @@ -0,0 +1,5 @@ +:mod:`mpl_toolkits.axes_grid1.axes_size` +======================================== + +.. automodule:: mpl_toolkits.axes_grid1.axes_size + :members: Fixed, Scaled, AxesX, AxesY, MaxWidth, MaxHeight, Fraction, Padded, from_any diff --git a/doc/mpl_toolkits/axes_grid/api/index.rst b/doc/mpl_toolkits/axes_grid1/api/index.rst similarity index 57% rename from doc/mpl_toolkits/axes_grid/api/index.rst rename to doc/mpl_toolkits/axes_grid1/api/index.rst index 672336ee2dbf..8a83b03f708e 100644 --- a/doc/mpl_toolkits/axes_grid/api/index.rst +++ b/doc/mpl_toolkits/axes_grid1/api/index.rst @@ -1,7 +1,7 @@ -.. _axes_grid-api-index: +.. _axes_grid1-api-index: ####################################### - The Matplotlib AxesGrid Toolkit API + The Matplotlib axes_grid1 Toolkit API ####################################### :Release: |version| @@ -9,20 +9,8 @@ .. toctree:: + anchored_artists_api.rst axes_size_api.rst axes_divider_api.rst axes_grid_api.rst - axis_artist_api.rst - - -####################################### - The Matplotlib axes_grid1 Toolkit API -####################################### - -:Release: |version| -:Date: |today| - -.. toctree:: - - anchored_artists_api.rst inset_locator_api.rst diff --git a/doc/mpl_toolkits/axes_grid/api/inset_locator_api.rst b/doc/mpl_toolkits/axes_grid1/api/inset_locator_api.rst similarity index 100% rename from doc/mpl_toolkits/axes_grid/api/inset_locator_api.rst rename to doc/mpl_toolkits/axes_grid1/api/inset_locator_api.rst diff --git a/doc/mpl_toolkits/axes_grid1/examples b/doc/mpl_toolkits/axes_grid1/examples new file mode 120000 index 000000000000..4a4be2d52c98 --- /dev/null +++ b/doc/mpl_toolkits/axes_grid1/examples @@ -0,0 +1 @@ +../../../examples/axes_grid1/ \ No newline at end of file diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_colorbar_of_inset_axes.py b/doc/mpl_toolkits/axes_grid1/figures/demo_colorbar_of_inset_axes.py similarity index 88% rename from doc/mpl_toolkits/axes_grid/figures/demo_colorbar_of_inset_axes.py rename to doc/mpl_toolkits/axes_grid1/figures/demo_colorbar_of_inset_axes.py index e4e708c6685a..326fefef6323 100644 --- a/doc/mpl_toolkits/axes_grid/figures/demo_colorbar_of_inset_axes.py +++ b/doc/mpl_toolkits/axes_grid1/figures/demo_colorbar_of_inset_axes.py @@ -1,7 +1,7 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.inset_locator import inset_axes, zoomed_inset_axes -from mpl_toolkits.axes_grid.colorbar import colorbar +from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes +from mpl_toolkits.axes_grid1.colorbar import colorbar def get_demo_image(): from matplotlib.cbook import get_sample_data @@ -46,4 +46,3 @@ def get_demo_image(): plt.draw() plt.show() - diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_colorbar_with_axes_divider.py b/doc/mpl_toolkits/axes_grid1/figures/demo_colorbar_with_axes_divider.py similarity index 82% rename from doc/mpl_toolkits/axes_grid/figures/demo_colorbar_with_axes_divider.py rename to doc/mpl_toolkits/axes_grid1/figures/demo_colorbar_with_axes_divider.py index 3816f013fbdf..e73f0c95c93f 100644 --- a/doc/mpl_toolkits/axes_grid/figures/demo_colorbar_with_axes_divider.py +++ b/doc/mpl_toolkits/axes_grid1/figures/demo_colorbar_with_axes_divider.py @@ -1,7 +1,7 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axes_divider import make_axes_locatable +from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable -from mpl_toolkits.axes_grid.colorbar import colorbar +from mpl_toolkits.axes_grid1.colorbar import colorbar # from matplotlib.pyplot import colorbar fig = plt.figure(1, figsize=(6, 3)) @@ -22,4 +22,3 @@ cb2 = colorbar(im2, cax=cax2, orientation="horizontal") cax2.xaxis.set_ticks_position("top") plt.show() - diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_fixed_size_axes.py b/doc/mpl_toolkits/axes_grid1/figures/demo_fixed_size_axes.py similarity index 94% rename from doc/mpl_toolkits/axes_grid/figures/demo_fixed_size_axes.py rename to doc/mpl_toolkits/axes_grid1/figures/demo_fixed_size_axes.py index 9c2b651e571c..7c235b477ccc 100644 --- a/doc/mpl_toolkits/axes_grid/figures/demo_fixed_size_axes.py +++ b/doc/mpl_toolkits/axes_grid1/figures/demo_fixed_size_axes.py @@ -1,7 +1,6 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid \ - import Divider, LocatableAxes, Size +from mpl_toolkits.axes_grid1 import Divider, LocatableAxes, Size def demo_fixed_size_axes(): diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_new_colorbar.py b/doc/mpl_toolkits/axes_grid1/figures/demo_new_colorbar.py similarity index 89% rename from doc/mpl_toolkits/axes_grid/figures/demo_new_colorbar.py rename to doc/mpl_toolkits/axes_grid1/figures/demo_new_colorbar.py index 88a722ee2241..de5d3e0de0c4 100644 --- a/doc/mpl_toolkits/axes_grid/figures/demo_new_colorbar.py +++ b/doc/mpl_toolkits/axes_grid1/figures/demo_new_colorbar.py @@ -10,7 +10,7 @@ cb1.ax.set_yticks([1, 3]) ax1.set_title("Original MPL's colorbar w/\nset_yticks([1,3])", size=10) -from mpl_toolkits.axes_grid.colorbar import colorbar +from mpl_toolkits.axes_grid1.colorbar import colorbar ax2 = fig.add_subplot(122) im2 = ax2.imshow([[1,2],[3,4]]) cb2 = colorbar(im2) @@ -18,4 +18,3 @@ ax2.set_title("AxesGrid's colorbar w/\nset_yticks([1,3])", size=10) plt.show() - diff --git a/doc/mpl_toolkits/axes_grid/figures/parasite_simple.py b/doc/mpl_toolkits/axes_grid1/figures/parasite_simple.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/parasite_simple.py rename to doc/mpl_toolkits/axes_grid1/figures/parasite_simple.py diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axes_divider1.py b/doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider1.py similarity index 91% rename from doc/mpl_toolkits/axes_grid/figures/simple_axes_divider1.py rename to doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider1.py index 7141fe88ce13..94149d082305 100644 --- a/doc/mpl_toolkits/axes_grid/figures/simple_axes_divider1.py +++ b/doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider1.py @@ -1,4 +1,4 @@ -from mpl_toolkits.axes_grid import Size, Divider +from mpl_toolkits.axes_grid1 import Size, Divider import matplotlib.pyplot as plt @@ -6,7 +6,7 @@ # fixed size in inch horiz = [Size.Fixed(1.), Size.Fixed(.5), Size.Fixed(1.5), - Size.Fixed(.5)] + Size.Fixed(.5)] vert = [Size.Fixed(1.5), Size.Fixed(.5), Size.Fixed(1.)] rect = (0.1, 0.1, 0.8, 0.8) @@ -25,6 +25,5 @@ ax4.set_axes_locator(divider.new_locator(nx=2, nx1=4, ny=0)) - plt.draw() plt.show() diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axes_divider2.py b/doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider2.py similarity index 90% rename from doc/mpl_toolkits/axes_grid/figures/simple_axes_divider2.py rename to doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider2.py index 7b866c3c0581..76198796c131 100644 --- a/doc/mpl_toolkits/axes_grid/figures/simple_axes_divider2.py +++ b/doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider2.py @@ -1,5 +1,5 @@ -import mpl_toolkits.axes_grid.axes_size as Size -from mpl_toolkits.axes_grid import Divider +import mpl_toolkits.axes_grid1.axes_size as Size +from mpl_toolkits.axes_grid1 import Divider import matplotlib.pyplot as plt fig1 = plt.figure(1, (5.5, 4.)) diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axes_divider3.py b/doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider3.py similarity index 91% rename from doc/mpl_toolkits/axes_grid/figures/simple_axes_divider3.py rename to doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider3.py index 203bdd5068eb..408fa5247b63 100644 --- a/doc/mpl_toolkits/axes_grid/figures/simple_axes_divider3.py +++ b/doc/mpl_toolkits/axes_grid1/figures/simple_axes_divider3.py @@ -1,5 +1,5 @@ -import mpl_toolkits.axes_grid.axes_size as Size -from mpl_toolkits.axes_grid import Divider +import mpl_toolkits.axes_grid1.axes_size as Size +from mpl_toolkits.axes_grid1 import Divider import matplotlib.pyplot as plt diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_colorbar.py b/doc/mpl_toolkits/axes_grid1/figures/simple_colorbar.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/simple_colorbar.py rename to doc/mpl_toolkits/axes_grid1/figures/simple_colorbar.py diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_rgb.py b/doc/mpl_toolkits/axes_grid1/figures/simple_rgb.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/simple_rgb.py rename to doc/mpl_toolkits/axes_grid1/figures/simple_rgb.py diff --git a/doc/mpl_toolkits/axes_grid1/index.rst b/doc/mpl_toolkits/axes_grid1/index.rst new file mode 100644 index 000000000000..1f758d12bc36 --- /dev/null +++ b/doc/mpl_toolkits/axes_grid1/index.rst @@ -0,0 +1,29 @@ + +.. _toolkit_axesgrid1-index: + +Matplotlib axes_grid1 Toolkit +============================= + +The matplotlib :class:`mpl_toolkits.axes_grid1` toolkit is a collection of +helper classes to ease displaying multiple images in matplotlib. While the +aspect parameter in matplotlib adjust the position of the single axes, +axesgrid1 toolkit provides a framework to adjust the position of +multiple axes according to their aspects. + + +.. image:: ../../_static/demo_axes_grid.png + +.. note:: + AxesGrid toolkit has been a part of matplotlib since v + 0.99. Originally, the toolkit had a single namespace of + *axes_grid*. In more recent version, the toolkit + has divided into two separate namespace (*axes_grid1* and *axisartist*). + While *axes_grid* namespace is maintained for the backward compatibility, + use of *axes_grid1* and *axisartist* is recommended. + +.. toctree:: + :maxdepth: 2 + + overview.rst + users/index.rst + api/index.rst diff --git a/doc/mpl_toolkits/axes_grid/users/overview.rst b/doc/mpl_toolkits/axes_grid1/overview.rst similarity index 69% rename from doc/mpl_toolkits/axes_grid/users/overview.rst rename to doc/mpl_toolkits/axes_grid1/overview.rst index 8a04b92ea55b..d86278e2896e 100644 --- a/doc/mpl_toolkits/axes_grid/users/overview.rst +++ b/doc/mpl_toolkits/axes_grid1/overview.rst @@ -1,11 +1,11 @@ -============================ -Overview of AxesGrid toolkit -============================ +============================== +Overview of axes_grid1 toolkit +============================== -What is AxesGrid toolkit? -========================= +What is axes_grid1 toolkit? +=========================== -The matplotlib AxesGrid toolkit is a collection of helper classes, +The matplotlib axes_grid1 toolkit is a collection of helper classes, mainly to ease displaying (multiple) images in matplotlib. .. contents:: @@ -15,32 +15,11 @@ mainly to ease displaying (multiple) images in matplotlib. .. note:: AxesGrid toolkit has been a part of matplotlib since v 0.99. Originally, the toolkit had a single namespace of - *axes_grid*. In more recent version (since svn r8226), the toolkit + *axes_grid*. In more recent version, the toolkit has divided into two separate namespace (*axes_grid1* and *axisartist*). While *axes_grid* namespace is maintained for the backward compatibility, use of *axes_grid1* and *axisartist* is recommended. -.. warning:: - *axes_grid* and *axisartist* (but not *axes_grid1*) uses - a custom Axes class (derived from the mpl's original Axes class). - As a side effect, some commands (mostly tick-related) do not work. - Use *axes_grid1* to avoid this, or see how things are different in - *axes_grid* and *axisartist* (LINK needed) - - -AxesGrid toolkit has two namespaces (*axes_grid1* and *axisartist*). -*axisartist* contains custom Axes class that is meant to support for -curvilinear grids (e.g., the world coordinate system in astronomy). -Unlike mpl's original Axes class which uses Axes.xaxis and Axes.yaxis -to draw ticks, ticklines and etc., Axes in axisartist uses special -artist (AxisArtist) which can handle tick, ticklines and etc. for -curved coordinate systems. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axis.py - -Since it uses a special artists, some mpl commands that work on -Axes.xaxis and Axes.yaxis may not work. See LINK for more detail. - *axes_grid1* is a collection of helper classes to ease displaying (multiple) images with matplotlib. In matplotlib, the axes location @@ -56,10 +35,10 @@ data (e.g., different y-scale) in a same Axes. `AnchoredArtists`_ includes custom artists which are placed at some anchored position, like the legend. -.. plot:: mpl_toolkits/axes_grid/examples/demo_axes_grid.py +.. plot:: mpl_toolkits/axes_grid1/examples/demo_axes_grid.py -AXES_GRID1 +axes_grid1 ========== ImageGrid @@ -73,7 +52,7 @@ ratio. For example, displaying images of a same size with some fixed padding between them cannot be easily done in matplotlib. ImageGrid is used in such case. -.. plot:: mpl_toolkits/axes_grid/examples/simple_axesgrid.py +.. plot:: mpl_toolkits/axes_grid1/examples/simple_axesgrid.py :include-source: * The position of each axes is determined at the drawing time (see @@ -87,7 +66,7 @@ used in such case. height. The widths (height) of the axes in the same row (column) are scaled according to their view limits (xlim or ylim). - .. plot:: mpl_toolkits/axes_grid/examples/simple_axesgrid2.py + .. plot:: mpl_toolkits/axes_grid1/examples/simple_axesgrid2.py :include-source: * xaxis are shared among axes in a same column. Similarly, yaxis are @@ -106,7 +85,7 @@ axes). -AxesGrid takes following arguments, +ImageGrid takes following arguments, ============= ======== ================================================ @@ -173,9 +152,9 @@ attribute. -The examples below show what you can do with AxesGrid. +The examples below show what you can do with ImageGrid. -.. plot:: mpl_toolkits/axes_grid/examples/demo_axes_grid.py +.. plot:: mpl_toolkits/axes_grid1/examples/demo_axes_grid.py AxesDivider @@ -206,7 +185,7 @@ creates a new axes on the given side of ("top", "right", "bottom" and colorbar whose height (or width) in sync with the master axes ------------------------------------------------------------- -.. plot:: mpl_toolkits/axes_grid/figures/simple_colorbar.py +.. plot:: mpl_toolkits/axes_grid1/figures/simple_colorbar.py :include-source: @@ -236,7 +215,7 @@ The "scatter_hist.py" example in mpl can be rewritten using See the full source code below. -.. plot:: mpl_toolkits/axes_grid/examples/scatter_hist.py +.. plot:: mpl_toolkits/axes_grid1/examples/scatter_hist.py The scatter_hist using the AxesDivider has some advantage over the @@ -271,7 +250,7 @@ parasite axes. To create a host axes, you may use *host_suplot* or Example 1. twinx ~~~~~~~~~~~~~~~~ -.. plot:: mpl_toolkits/axes_grid/figures/parasite_simple.py +.. plot:: mpl_toolkits/axes_grid1/figures/parasite_simple.py :include-source: Example 2. twin @@ -288,7 +267,7 @@ tick-formatter for bottom(or left)-axis. :: r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"]) -.. plot:: mpl_toolkits/axes_grid/examples/simple_axisline4.py +.. plot:: mpl_toolkits/axes_grid1/examples/simple_axisline4.py @@ -297,7 +276,7 @@ x-limit in the host axes, the x-limit of the parasite axes will change accordingly. -.. plot:: mpl_toolkits/axes_grid/examples/parasite_simple2.py +.. plot:: mpl_toolkits/axes_grid1/examples/parasite_simple2.py AnchoredArtists @@ -310,18 +289,18 @@ limited support for an arbitrary transform. For example, the ellipse in the example below will have width and height in the data coordinate. -.. plot:: mpl_toolkits/axes_grid/examples/simple_anchored_artists.py +.. plot:: mpl_toolkits/axes_grid1/examples/simple_anchored_artists.py :include-source: InsetLocator ------------ -:mod:`mpl_toolkits.axes_grid.inset_locator` provides helper classes +:mod:`mpl_toolkits.axes_grid1.inset_locator` provides helper classes and functions to place your (inset) axes at the anchored position of the parent axes, similarly to AnchoredArtist. -Using :func:`mpl_toolkits.axes_grid.inset_locator.inset_axes`, you +Using :func:`mpl_toolkits.axes_grid1.inset_locator.inset_axes`, you can have inset axes whose size is either fixed, or a fixed proportion of the parent axes. For example,:: @@ -344,7 +323,7 @@ some factor. For example, :: creates an inset axes whose data scale is half of the parent axes. Here is complete examples. -.. plot:: mpl_toolkits/axes_grid/examples/inset_locator_demo.py +.. plot:: mpl_toolkits/axes_grid1/examples/inset_locator_demo.py For example, :func:`zoomed_inset_axes` can be used when you want the inset represents the zoom-up of the small portion in the parent axes. @@ -352,7 +331,7 @@ And :mod:`~mpl_toolkits/axes_grid/inset_locator` provides a helper function :func:`mark_inset` to mark the location of the area represented by the inset axes. -.. plot:: mpl_toolkits/axes_grid/examples/inset_locator_demo2.py +.. plot:: mpl_toolkits/axes_grid1/examples/inset_locator_demo2.py :include-source: @@ -374,107 +353,4 @@ yaxis of each axes are shared. :: origin="lower", interpolation="nearest") -.. plot:: mpl_toolkits/axes_grid/figures/simple_rgb.py - - -AXISARTIST -========== - - -AxisArtist ----------- - -AxisArtist module provides a custom (and very experimental) Axes -class, where each axis (left, right, top and bottom) have a separate -artist associated which is responsible to draw axis-line, ticks, -ticklabels, label. Also, you can create your own axis, which can pass -through a fixed position in the axes coordinate, or a fixed position -in the data coordinate (i.e., the axis floats around when viewlimit -changes). - -The axes class, by default, have its xaxis and yaxis invisible, and -has 4 additional artists which are responsible to draw axis in -"left","right","bottom" and "top". They are accessed as -ax.axis["left"], ax.axis["right"], and so on, i.e., ax.axis is a -dictionary that contains artists (note that ax.axis is still a -callable methods and it behaves as an original Axes.axis method in -mpl). - -To create an axes, :: - - import mpl_toolkits.axisartist as AA - fig = plt.figure(1) - ax = AA.Axes(fig, [0.1, 0.1, 0.8, 0.8]) - fig.add_axes(ax) - -or to create a subplot :: - - ax = AA.Subplot(fig, 111) - fig.add_subplot(ax) - -For example, you can hide the right, and top axis by :: - - ax.axis["right"].set_visible(False) - ax.axis["top"].set_visible(False) - - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axisline3.py - - -It is also possible to add an extra axis. For example, you may have an -horizontal axis at y=0 (in data coordinate). :: - - ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0) - -.. plot:: mpl_toolkits/axes_grid/figures/simple_axisartist1.py - :include-source: - - -Or a fixed axis with some offset :: - - # make new (right-side) yaxis, but wth some offset - ax.axis["right2"] = ax.new_fixed_axis(loc="right", - offset=(20, 0)) - - - -AxisArtist with ParasiteAxes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Most commands in the axes_grid1 toolkit can take a axes_class keyword -argument, and the commands creates an axes of the given class. For example, -to create a host subplot with axisartist.Axes, :: - - import mpl_tookits.axisartist as AA - from mpl_toolkits.axes_grid1 import host_subplot - - host = host_subplot(111, axes_class=AA.Axes) - - -Here is an example that uses parasiteAxes. - - -.. plot:: mpl_toolkits/axes_grid/examples/demo_parasite_axes2.py - - - -Curvilinear Grid ----------------- - -The motivation behind the AxisArtist module is to support curvilinear grid -and ticks. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py - -See :ref:`axisartist-manual` for more details. - - -Floating Axes -------------- - -This also support a Floating Axes whose outer axis are defined as -floating axis. - -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axes.py - - +.. plot:: mpl_toolkits/axes_grid1/figures/simple_rgb.py diff --git a/doc/mpl_toolkits/axes_grid/users/axes_divider.rst b/doc/mpl_toolkits/axes_grid1/users/axes_divider.rst similarity index 85% rename from doc/mpl_toolkits/axes_grid/users/axes_divider.rst rename to doc/mpl_toolkits/axes_grid1/users/axes_divider.rst index fe0b782306c5..830cee84ef73 100644 --- a/doc/mpl_toolkits/axes_grid/users/axes_divider.rst +++ b/doc/mpl_toolkits/axes_grid1/users/axes_divider.rst @@ -4,11 +4,11 @@ AxesDivider The axes_divider module provide helper classes to adjust the axes positions of set of images in the drawing time. -* :mod:`~mpl_toolkits.axes_grid.axes_size` provides a classes of +* :mod:`~mpl_toolkits.axes_grid1.axes_size` provides a classes of units that the size of each axes will be determined. For example, you can specify a fixed size -* :class:`~mpl_toolkits.axes_grid.axes_size.Divider` this is the class +* :class:`~mpl_toolkits.axes_grid1.axes_size.Divider` this is the class that is used calculates the axes position. It divides the given rectangular area into several areas. You initialize the divider by setting the horizontal and vertical list of sizes that the division @@ -29,7 +29,7 @@ for example,:: where, rect is a bounds of the box that will be divided and h0,..h3, v0,..v2 need to be an instance of classes in the -:mod:`~mpl_toolkits.axes_grid.axes_size`. They have *get_size* method +:mod:`~mpl_toolkits.axes_grid1.axes_size`. They have *get_size* method that returns a tuple of two floats. The first float is the relative size, and the second float is the absolute size. Consider a following grid. @@ -56,11 +56,11 @@ determined. When aspect ratio is set, the total height (or width) will be adjusted accordingly. -The :mod:`mpl_toolkits.axes_grid.axes_size` contains several classes +The :mod:`mpl_toolkits.axes_grid1.axes_size` contains several classes that can be used to set the horizontal and vertical configurations. For example, for the vertical configuration above will be:: - from mpl_toolkits.axes_grid.axes_size import Fixed, Scaled + from mpl_toolkits.axes_grid1.axes_size import Fixed, Scaled vert = [Fixed(2), Scaled(2), Scaled(3)] After you set up the divider object, then you create a locator @@ -82,12 +82,11 @@ may consider it as [0:2, 1]. See the example, -.. plot:: mpl_toolkits/axes_grid/figures/simple_axes_divider2.py +.. plot:: mpl_toolkits/axes_grid1/figures/simple_axes_divider2.py :include-source: You can adjust the size of the each axes according to their x or y data limits (AxesX and AxesY), similar to the axes aspect parameter. -.. plot:: mpl_toolkits/axes_grid/figures/simple_axes_divider3.py +.. plot:: mpl_toolkits/axes_grid1/figures/simple_axes_divider3.py :include-source: - diff --git a/doc/mpl_toolkits/axes_grid1/users/index.rst b/doc/mpl_toolkits/axes_grid1/users/index.rst new file mode 100644 index 000000000000..9251b9298a73 --- /dev/null +++ b/doc/mpl_toolkits/axes_grid1/users/index.rst @@ -0,0 +1,12 @@ +.. _axes_grid1_users-guide-index: + +################################################# + The Matplotlib axes_grid1 Toolkit User's Guide +################################################# + +:Release: |version| +:Date: |today| + +.. toctree:: + + axes_divider.rst diff --git a/doc/mpl_toolkits/axisartist/api/axis_artist_api.rst b/doc/mpl_toolkits/axisartist/api/axis_artist_api.rst new file mode 100644 index 000000000000..e8705fc01b45 --- /dev/null +++ b/doc/mpl_toolkits/axisartist/api/axis_artist_api.rst @@ -0,0 +1,16 @@ + +:mod:`mpl_toolkits.axisartist.axis_artist` +========================================== + +.. autoclass:: mpl_toolkits.axisartist.axis_artist.AxisArtist + :members: + :undoc-members: + +.. autoclass:: mpl_toolkits.axisartist.axis_artist.Ticks + :members: + +.. autoclass:: mpl_toolkits.axisartist.axis_artist.AxisLabel + :members: + +.. autoclass:: mpl_toolkits.axisartist.axis_artist.TickLabels + :members: diff --git a/doc/mpl_toolkits/axisartist/api/index.rst b/doc/mpl_toolkits/axisartist/api/index.rst new file mode 100644 index 000000000000..069d82bc7c29 --- /dev/null +++ b/doc/mpl_toolkits/axisartist/api/index.rst @@ -0,0 +1,12 @@ +.. _axisartist-api-index: + +####################################### + The Matplotlib axisartist Toolkit API +####################################### + +:Release: |version| +:Date: |today| + +.. toctree:: + + axis_artist_api.rst diff --git a/doc/mpl_toolkits/axisartist/examples b/doc/mpl_toolkits/axisartist/examples new file mode 120000 index 000000000000..bd4a984623a0 --- /dev/null +++ b/doc/mpl_toolkits/axisartist/examples @@ -0,0 +1 @@ +../../../examples/axisartist/ \ No newline at end of file diff --git a/doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py b/doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step01.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py rename to doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step01.py diff --git a/doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py b/doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step02.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py rename to doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step02.py diff --git a/doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py b/doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step03.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py rename to doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step03.py diff --git a/doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py b/doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step04.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py rename to doc/mpl_toolkits/axisartist/figures/axis_direction_demo_step04.py diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_axis_direction.py b/doc/mpl_toolkits/axisartist/figures/demo_axis_direction.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/demo_axis_direction.py rename to doc/mpl_toolkits/axisartist/figures/demo_axis_direction.py diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_parasite_axes.py b/doc/mpl_toolkits/axisartist/figures/demo_parasite_axes.py similarity index 95% rename from doc/mpl_toolkits/axes_grid/figures/demo_parasite_axes.py rename to doc/mpl_toolkits/axisartist/figures/demo_parasite_axes.py index a42c9b6493fc..5e465b2b32a6 100644 --- a/doc/mpl_toolkits/axes_grid/figures/demo_parasite_axes.py +++ b/doc/mpl_toolkits/axisartist/figures/demo_parasite_axes.py @@ -1,4 +1,4 @@ -from mpl_toolkits.axes_grid.parasite_axes import HostAxes, ParasiteAxes +from mpl_toolkits.axisartist.parasite_axes import HostAxes, ParasiteAxes import matplotlib.pyplot as plt if __name__ == "__main__": diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py b/doc/mpl_toolkits/axisartist/figures/demo_ticklabel_alignment.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py rename to doc/mpl_toolkits/axisartist/figures/demo_ticklabel_alignment.py diff --git a/doc/mpl_toolkits/axes_grid/figures/demo_ticklabel_direction.py b/doc/mpl_toolkits/axisartist/figures/demo_ticklabel_direction.py similarity index 95% rename from doc/mpl_toolkits/axes_grid/figures/demo_ticklabel_direction.py rename to doc/mpl_toolkits/axisartist/figures/demo_ticklabel_direction.py index cd205991363a..a52d353494d4 100644 --- a/doc/mpl_toolkits/axes_grid/figures/demo_ticklabel_direction.py +++ b/doc/mpl_toolkits/axisartist/figures/demo_ticklabel_direction.py @@ -1,6 +1,6 @@ import matplotlib.pyplot as plt -import mpl_toolkits.axes_grid.axislines as axislines +import mpl_toolkits.axisartist.axislines as axislines def setup_axes(fig, rect): diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axis_direction01.py b/doc/mpl_toolkits/axisartist/figures/simple_axis_direction01.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/simple_axis_direction01.py rename to doc/mpl_toolkits/axisartist/figures/simple_axis_direction01.py diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axis_direction03.py b/doc/mpl_toolkits/axisartist/figures/simple_axis_direction03.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/simple_axis_direction03.py rename to doc/mpl_toolkits/axisartist/figures/simple_axis_direction03.py diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axis_pad.py b/doc/mpl_toolkits/axisartist/figures/simple_axis_pad.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/simple_axis_pad.py rename to doc/mpl_toolkits/axisartist/figures/simple_axis_pad.py diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axisartist1.py b/doc/mpl_toolkits/axisartist/figures/simple_axisartist1.py similarity index 100% rename from doc/mpl_toolkits/axes_grid/figures/simple_axisartist1.py rename to doc/mpl_toolkits/axisartist/figures/simple_axisartist1.py diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axisline.py b/doc/mpl_toolkits/axisartist/figures/simple_axisline.py similarity index 94% rename from doc/mpl_toolkits/axes_grid/figures/simple_axisline.py rename to doc/mpl_toolkits/axisartist/figures/simple_axisline.py index ef74cb4ebfdc..6c0d585c8ee3 100644 --- a/doc/mpl_toolkits/axes_grid/figures/simple_axisline.py +++ b/doc/mpl_toolkits/axisartist/figures/simple_axisline.py @@ -1,6 +1,6 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axislines import SubplotZero +from mpl_toolkits.axisartist.axislines import SubplotZero if 1: @@ -36,4 +36,3 @@ ax.plot([-2,3,2]) plt.draw() plt.show() - diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axisline2.py b/doc/mpl_toolkits/axisartist/figures/simple_axisline2.py similarity index 90% rename from doc/mpl_toolkits/axes_grid/figures/simple_axisline2.py rename to doc/mpl_toolkits/axisartist/figures/simple_axisline2.py index 5440aec168a1..488fd95bb518 100644 --- a/doc/mpl_toolkits/axes_grid/figures/simple_axisline2.py +++ b/doc/mpl_toolkits/axisartist/figures/simple_axisline2.py @@ -1,5 +1,5 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axislines import SubplotZero +from mpl_toolkits.axisartist.axislines import SubplotZero import numpy as np fig = plt.figure(1, (4,3)) @@ -21,4 +21,3 @@ ax.plot(xx, np.sin(xx)) plt.show() - diff --git a/doc/mpl_toolkits/axes_grid/figures/simple_axisline3.py b/doc/mpl_toolkits/axisartist/figures/simple_axisline3.py similarity index 77% rename from doc/mpl_toolkits/axes_grid/figures/simple_axisline3.py rename to doc/mpl_toolkits/axisartist/figures/simple_axisline3.py index 68d42677cd54..8256b5669ee4 100644 --- a/doc/mpl_toolkits/axes_grid/figures/simple_axisline3.py +++ b/doc/mpl_toolkits/axisartist/figures/simple_axisline3.py @@ -1,5 +1,5 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axislines import Subplot +from mpl_toolkits.axisartist.axislines import Subplot fig = plt.figure(1, (3,3)) @@ -10,4 +10,3 @@ ax.axis["top"].set_visible(False) plt.show() - diff --git a/doc/mpl_toolkits/axisartist/index.rst b/doc/mpl_toolkits/axisartist/index.rst new file mode 100644 index 000000000000..22855f1f2cdd --- /dev/null +++ b/doc/mpl_toolkits/axisartist/index.rst @@ -0,0 +1,11 @@ +.. _toolkit_axisartist-index: + +Matplotlib axisartist Toolkit +============================= + +.. toctree:: + :maxdepth: 2 + + overview.rst + users/index.rst + api/index.rst diff --git a/doc/mpl_toolkits/axisartist/overview.rst b/doc/mpl_toolkits/axisartist/overview.rst new file mode 100644 index 000000000000..a284b5e247fe --- /dev/null +++ b/doc/mpl_toolkits/axisartist/overview.rst @@ -0,0 +1,117 @@ +============================== +Overview of axisartist toolkit +============================== + +.. warning:: + *axisartist* uses a custom Axes class + (derived from the mpl's original Axes class). + As a side effect, some commands (mostly tick-related) do not work. + + +The *axisartist* contains custom Axes class that is meant to support for +curvilinear grids (e.g., the world coordinate system in astronomy). +Unlike mpl's original Axes class which uses Axes.xaxis and Axes.yaxis +to draw ticks, ticklines and etc., Axes in axisartist uses special +artist (AxisArtist) which can handle tick, ticklines and etc. for +curved coordinate systems. + +.. plot:: mpl_toolkits/axisartist/examples/demo_floating_axis.py + +Since it uses special artists, some mpl commands that work on +Axes.xaxis and Axes.yaxis may not work. + +axisartist +---------- + +*axisartist* module provides a custom (and very experimental) Axes +class, where each axis (left, right, top and bottom) have a separate +associated artist which is responsible to draw axis-line, ticks, +ticklabels, label. Also, you can create your own axis, which can pass +through a fixed position in the axes coordinate, or a fixed position +in the data coordinate (i.e., the axis floats around when viewlimit +changes). + +The axes class, by default, has its xaxis and yaxis invisible, and +has 4 additional artists which are responsible for drawing the 4 axis sides in +"left","right","bottom" and "top". They are accessed as +ax.axis["left"], ax.axis["right"], and so on, i.e., ax.axis is a +dictionary that contains artists (note that ax.axis is still a +callable methods and it behaves as an original Axes.axis method in +mpl). + +To create an axes, :: + + import mpl_toolkits.axisartist as AA + fig = plt.figure(1) + ax = AA.Axes(fig, [0.1, 0.1, 0.8, 0.8]) + fig.add_axes(ax) + +or to create a subplot :: + + ax = AA.Subplot(fig, 111) + fig.add_subplot(ax) + +For example, you can hide the right, and top axis by :: + + ax.axis["right"].set_visible(False) + ax.axis["top"].set_visible(False) + + +.. plot:: mpl_toolkits/axisartist/figures/simple_axisline3.py + + +It is also possible to add an extra axis. For example, you may have an +horizontal axis at y=0 (in data coordinate). :: + + ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0) + +.. plot:: mpl_toolkits/axisartist/figures/simple_axisartist1.py + :include-source: + + +Or a fixed axis with some offset :: + + # make new (right-side) yaxis, but wth some offset + ax.axis["right2"] = ax.new_fixed_axis(loc="right", + offset=(20, 0)) + + + +axisartist with ParasiteAxes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Most commands in the axes_grid1 toolkit can take a axes_class keyword +argument, and the commands creates an axes of the given class. For example, +to create a host subplot with axisartist.Axes, :: + + import mpl_tookits.axisartist as AA + from mpl_toolkits.axes_grid1 import host_subplot + + host = host_subplot(111, axes_class=AA.Axes) + + +Here is an example that uses parasiteAxes. + + +.. plot:: mpl_toolkits/axisartist/examples/demo_parasite_axes2.py + + + +Curvilinear Grid +---------------- + +The motivation behind the AxisArtist module is to support curvilinear grid +and ticks. + +.. plot:: mpl_toolkits/axisartist/examples/demo_curvelinear_grid.py + +See :ref:`axisartist-manual` for more details. + + +Floating Axes +------------- + +This also support a Floating Axes whose outer axis are defined as +floating axis. + +.. plot:: mpl_toolkits/axisartist/examples/demo_floating_axes.py diff --git a/doc/mpl_toolkits/axes_grid/users/axisartist.rst b/doc/mpl_toolkits/axisartist/users/axisartist.rst similarity index 93% rename from doc/mpl_toolkits/axes_grid/users/axisartist.rst rename to doc/mpl_toolkits/axisartist/users/axisartist.rst index 67cdf64ecfa1..09c24055f598 100644 --- a/doc/mpl_toolkits/axes_grid/users/axisartist.rst +++ b/doc/mpl_toolkits/axisartist/users/axisartist.rst @@ -1,10 +1,10 @@ .. _axisartist-manual: ==================== -AXISARTIST namespace +axisartist namespace ==================== -The AxisArtist namespace includes a derived Axes implementation. The +The *axisartist* namespace includes a derived Axes implementation. The biggest difference is that the artists responsible to draw axis line, ticks, ticklabel and axis labels are separated out from the mpl's Axis class, which are much more than artists in the original mpl. This @@ -29,7 +29,7 @@ In summary, all these changes was to support * a curvilinear grid. * a floating axis -.. plot:: mpl_toolkits/axes_grid/examples/demo_floating_axis.py +.. plot:: mpl_toolkits/axisartist/examples/demo_floating_axis.py *mpl_toolkits.axisartist.Axes* class defines a *axis* attribute, which @@ -117,15 +117,15 @@ ticklabels, and label. To make ticklabel invisible, :: ax.axis["bottom"].toggle(ticklabels=False) To make all of ticks, ticklabels, and (axis) label invisible :: - + ax.axis["bottom"].toggle(all=False) - + To turn all off but ticks on :: - + ax.axis["bottom"].toggle(all=False, ticks=True) - + To turn all on but (axis) label off :: - + ax.axis["bottom"].toggle(all=True, label=False)) @@ -140,7 +140,7 @@ Note that 'ax.axis["top","right"]' returns a simple proxy object that translate ax.axis[n].toggle(ticklabels=True)) So, any return values in the for loop are ignored. And you should not -use it anything more than a simple method. +use it anything more than a simple method. Like the list indexing ":" means all items, i.e., :: @@ -195,7 +195,7 @@ using "set_axis_direction" method. :: ax1.axis["left"].major_ticklabels.set_axis_direction("top") ax1.axis["right"].label.set_axis_direction("left") -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_direction01.py +.. plot:: mpl_toolkits/axisartist/figures/simple_axis_direction01.py The parameter for set_axis_direction is one of ["left", "right", "bottom", "top"]. @@ -206,7 +206,7 @@ You must understand some underlying concept of directions. of the axis line with increasing coordinate. For example, the reference direction of the left x-axis is from bottom to top. - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step01.py + .. plot:: mpl_toolkits/axisartist/figures/axis_direction_demo_step01.py The direction, text angle, and alignments of the ticks, ticklabels and axis-label is determined with respect to the reference direction @@ -214,11 +214,11 @@ You must understand some underlying concept of directions. 2. *ticklabel_direction* is either the right-hand side (+) of the reference direction or the left-hand side (-). - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step02.py + .. plot:: mpl_toolkits/axisartist/figures/axis_direction_demo_step02.py 3. same for the *label_direction* - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step03.py + .. plot:: mpl_toolkits/axisartist/figures/axis_direction_demo_step03.py 4. ticks are by default drawn toward the opposite direction of the ticklabels. @@ -226,12 +226,12 @@ You must understand some underlying concept of directions. to the *ticklabel_direction* or *label_direction*, respectively. The rotation of ticklabels and label is anchored. - .. plot:: mpl_toolkits/axes_grid/figures/axis_direction_demo_step04.py + .. plot:: mpl_toolkits/axisartist/figures/axis_direction_demo_step04.py On the other hand, there is a concept of "axis_direction". This is a default setting of above properties for each, "bottom", "left", "top", -and "right" axis. +and "right" axis. ========== =========== ========= ========== ========= ========== ? ? left bottom right top @@ -245,13 +245,13 @@ and "right" axis. ticklabel ha right center right center ticklabel va center baseline center baseline ========== =========== ========= ========== ========= ========== - + And, 'set_axis_direction("top")' means to adjust the text rotation etc, for settings suitable for "top" axis. The concept of axis direction can be more clear with curved axis. -.. plot:: mpl_toolkits/axes_grid/figures/demo_axis_direction.py +.. plot:: mpl_toolkits/axisartist/figures/demo_axis_direction.py The axis_direction can be adjusted in the AxisArtist level, or in the level of its child arists, i.e., ticks, ticklabels, and axis-label. :: @@ -270,21 +270,21 @@ axis_direction of ticks, ticklabels, and axis-label does not affect them. -If you want to make ticks outward and ticklabels inside the axes, +If you want to make ticks outward and ticklabels inside the axes, use invert_ticklabel_direction method. :: ax.axis[:].invert_ticklabel_direction() - + A related method is "set_tick_out". It makes ticks outward (as a matter of fact, it makes ticks toward the opposite direction of the default direction). :: ax.axis[:].major_ticks.set_tick_out(True) -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_direction03.py +.. plot:: mpl_toolkits/axisartist/figures/simple_axis_direction03.py -So, in summary, +So, in summary, * AxisArtist's methods * set_axis_direction : "left", "right", "bottom", or "top" @@ -310,7 +310,7 @@ Adjusting ticklabels alignment Alignment of TickLabels are treated specially. See below -.. plot:: mpl_toolkits/axes_grid/figures/demo_ticklabel_alignment.py +.. plot:: mpl_toolkits/axisartist/figures/demo_ticklabel_alignment.py Adjusting pad -------------- @@ -324,7 +324,7 @@ Or ticklabels and axis-label :: ax.axis["left"].label.set_pad(10) -.. plot:: mpl_toolkits/axes_grid/figures/simple_axis_pad.py +.. plot:: mpl_toolkits/axisartist/figures/simple_axis_pad.py GridHelper @@ -418,7 +418,7 @@ coordinates, or you may use Parasite Axes for convenience.:: ax1.parasites.append(ax2) -.. plot:: mpl_toolkits/axes_grid/examples/demo_curvelinear_grid.py +.. plot:: mpl_toolkits/axisartist/examples/demo_curvelinear_grid.py diff --git a/doc/mpl_toolkits/axes_grid/users/index.rst b/doc/mpl_toolkits/axisartist/users/index.rst similarity index 62% rename from doc/mpl_toolkits/axes_grid/users/index.rst rename to doc/mpl_toolkits/axisartist/users/index.rst index 9ae9dbdd74bb..88f452378981 100644 --- a/doc/mpl_toolkits/axes_grid/users/index.rst +++ b/doc/mpl_toolkits/axisartist/users/index.rst @@ -1,7 +1,7 @@ -.. _axes_grid_users-guide-index: +.. _axisartist_users-guide-index: ################################################ - The Matplotlib AxesGrid Toolkit User's Guide + The Matplotlib axisartist Toolkit User's Guide ################################################ :Release: |version| @@ -9,6 +9,4 @@ .. toctree:: - axes_divider.rst axisartist.rst - diff --git a/doc/mpl_toolkits/index.rst b/doc/mpl_toolkits/index.rst index ba3ae7efc305..0e37f54e8c23 100644 --- a/doc/mpl_toolkits/index.rst +++ b/doc/mpl_toolkits/index.rst @@ -3,7 +3,8 @@ .. toctree:: :hidden: - axes_grid/index.rst + axes_grid1/index.rst + axisartist/index.rst mplot3d/index.rst .. _toolkits: @@ -17,57 +18,10 @@ Toolkits Toolkits are collections of application-specific functions that extend matplotlib. -.. _toolkits-mapping: - - -Mapping Toolkits -**************** - - -.. _toolkit_basemap: - -Basemap -======= -(*Not distributed with matplotlib*) - -Plots data on map projections, with continental and political -boundaries, see `basemap `_ -docs. - -.. image:: /_static/basemap_contour1.png - :height: 400px - - - -Cartopy -======= -(*Not distributed with matplotlib*) - -An alternative mapping library written for matplotlib ``v1.2`` and beyond. -`Cartopy `_ builds on top of -matplotlib to provide object oriented map projection definitions and close -integration with Shapely for powerful yet easy-to-use vector data processing -tools. An example plot from the -`Cartopy gallery `_: - -.. image:: /_static/cartopy_hurricane_katrina_01_00.png - :height: 400px - - -.. _toolkits-shipped: - - -General Toolkits -**************** - .. _toolkit_mplot3d: mplot3d ======= -.. toctree:: - :maxdepth: 2 - - mplot3d/index :ref:`mpl_toolkits.mplot3d ` provides some basic 3D plotting (scatter, surf, @@ -77,34 +31,28 @@ solution for some use cases. .. plot:: mpl_examples/mplot3d/contourf3d_demo2.py -.. _toolkit_axes_grid: +.. _toolkit_axes_grid1: -AxesGrid -======== -.. toctree:: - :maxdepth: 2 - - axes_grid/index +axes_grid1 +========== -The matplotlib :ref:`AxesGrid ` toolkit is a collection of helper classes to -ease displaying multiple images in matplotlib. The AxesGrid toolkit is -distributed with matplotlib source. +The :ref:`mpl_toolkits.axes_grid1 ` toolkit is a +collection of helper classes to ease displaying multiple axes in matplotlib. .. image:: /_static/demo_axes_grid.png -.. _toolkit_mpldatacursor: +.. _toolkit_axisartist: + +axisartist +========== -MplDataCursor -============= -(*Not distributed with matplotlib*) -`MplDataCursor `_ is a -toolkit written by Joe Kington to provide interactive "data cursors" -(clickable annotation boxes) for matplotlib. +The :ref:`mpl_toolkits.axisartist ` toolkit contains +a custom Axes class that is meant to support for curvilinear grids. .. _toolkit_gtk: @@ -112,7 +60,7 @@ toolkit written by Joe Kington to provide interactive "data cursors" GTK Tools ========= -mpl_toolkits.gtktools provides some utilities for working with GTK. +``mpl_toolkits.gtktools`` provides some utilities for working with GTK. This toolkit ships with matplotlib, but requires `pygtk `_. @@ -122,83 +70,6 @@ This toolkit ships with matplotlib, but requires `pygtk Excel Tools =========== -mpl_toolkits.exceltools provides some utilities for working with +``mpl_toolkits.exceltools`` provides some utilities for working with Excel. This toolkit ships with matplotlib, but requires `xlwt `_ - - -.. _toolkit_natgrid: - -Natgrid -======= -(*Not distributed with matplotlib*) - -mpl_toolkits.natgrid is an interface to natgrid C library for gridding -irregularly spaced data. This requires a separate installation of the -`natgrid toolkit `__. - - -.. _toolkit_matplotlibvenn: - -Matplotlib-Venn -=============== -(*Not distributed with matplotlib*) - -`Matplotlib-Venn `_ provides a set of functions for plotting 2- and 3-set area-weighted (or unweighted) Venn diagrams. - -mplstereonet -=============== -(*Not distributed with matplotlib*) - -`mplstereonet `_ provides stereonets for plotting and analyzing orientation data in Matplotlib. - - -.. _hl_plotting: - -High-Level Plotting -******************* - -Several projects have started to provide a higher-level interface to -matplotlib. These are independent projects. - -.. _toolkit_seaborn: - -seaborn -======= -(*Not distributed with matplotlib*) - -`seaborn `_ is a high -level interface for drawing statistical graphics with matplotlib. It -aims to make visualization a central part of exploring and -understanding complex datasets. - -.. _toolkit_ggplot: - -ggplot -====== -(*Not distributed with matplotlib*) - -`ggplot `_ is a port of the R ggplot2 -to python based on matplotlib. - - -.. _toolkit_prettyplotlib: - -prettyplotlib -============= -(*Not distributed with matplotlib*) - -`prettyplotlib `_ is an extension -to matplotlib which changes many of the defaults to make plots some -consider more attractive. - - -iTerm2 terminal backend -======================= -(*Not distributed with matplotlib*) - -`matplotlib_iterm2 `_ is an -external matplotlib backend uses iTerm2 nightly build inline image display -feature. - -.. image:: /_static/matplotlib_iterm2_demo.png diff --git a/doc/pyplots/whats_new_99_axes_grid.py b/doc/pyplots/whats_new_99_axes_grid.py index e3cb7fa4217d..354eadf7dfdb 100644 --- a/doc/pyplots/whats_new_99_axes_grid.py +++ b/doc/pyplots/whats_new_99_axes_grid.py @@ -1,6 +1,6 @@ import numpy as np import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.axes_rgb import RGBAxes +from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes def get_demo_image(): # prepare image diff --git a/doc/thirdpartypackages/index.rst b/doc/thirdpartypackages/index.rst new file mode 100644 index 000000000000..00db36122991 --- /dev/null +++ b/doc/thirdpartypackages/index.rst @@ -0,0 +1,130 @@ +.. _thirdparty-index: + +********************* + Third party packages +********************* + +Several external packages that extend or build on Matplotlib functionality +exist. Below we list a number of these. Please submit an issue or pull request +on Github if you have created a package that you would like to have included. +We are also happy to host third party packages within the `Matplotlib Github +Organization `_. + +.. _toolkits-general: + +General Toolkits +**************** + + +.. _toolkit_mpldatacursor: + +MplDataCursor +============= + +`MplDataCursor `_ is a +toolkit written by Joe Kington to provide interactive "data cursors" +(clickable annotation boxes) for matplotlib. + + +.. _toolkit_natgrid: + +Natgrid +======= + +mpl_toolkits.natgrid is an interface to natgrid C library for gridding +irregularly spaced data. This requires a separate installation of the +`natgrid toolkit `__. + + +.. _toolkit_matplotlibvenn: + +Matplotlib-Venn +=============== + +`Matplotlib-Venn `_ provides a set of functions for plotting 2- and 3-set area-weighted (or unweighted) Venn diagrams. + +mplstereonet +=============== + +`mplstereonet `_ provides stereonets for plotting and analyzing orientation data in Matplotlib. + + +.. _hl_plotting: + +High-Level Plotting +******************* + +Several projects have started to provide a higher-level interface to +matplotlib. These are independent projects. + +.. _toolkit_seaborn: + +seaborn +======= + +`seaborn `_ is a high +level interface for drawing statistical graphics with matplotlib. It +aims to make visualization a central part of exploring and +understanding complex datasets. + +.. _toolkit_ggplot: + +ggplot +====== + +`ggplot `_ is a port of the R ggplot2 +to python based on matplotlib. + + +.. _toolkit_prettyplotlib: + +prettyplotlib +============= + +`prettyplotlib `_ is an extension +to matplotlib which changes many of the defaults to make plots some +consider more attractive. + + +iTerm2 terminal backend +======================= + +`matplotlib_iterm2 `_ is an +external matplotlib backend using iTerm2 nightly build inline image display +feature. + +.. image:: /_static/matplotlib_iterm2_demo.png + + +.. _toolkits-mapping: + +Mapping Toolkits +**************** + + +.. _toolkit_basemap: + +Basemap +======= + +Plots data on map projections, with continental and political +boundaries, see `basemap `_ +docs. + +.. image:: /_static/basemap_contour1.png + :height: 400px + + + +Cartopy +======= + +An alternative mapping library written for matplotlib ``v1.2`` and beyond. +`Cartopy `_ builds on top of +matplotlib to provide object oriented map projection definitions and close +integration with Shapely for powerful yet easy-to-use vector data processing +tools. An example plot from the +`Cartopy gallery `_: + +.. image:: /_static/cartopy_hurricane_katrina_01_00.png + :height: 400px diff --git a/doc/users/annotations_guide.rst b/doc/users/annotations_guide.rst index 70ef8c42fdaf..12c78d55b713 100644 --- a/doc/users/annotations_guide.rst +++ b/doc/users/annotations_guide.rst @@ -194,9 +194,10 @@ Placing Artist at the anchored location of the Axes There are class of artist that can be placed at the anchored location of the Axes. A common example is the legend. This type of artists can be created by using the OffsetBox class. A few predefined classes are -available in ``mpl_toolkits.axes_grid.anchored_artists``. :: +available in ``mpl_toolkits.axes_grid1.anchored_artists`` others in +``matplotlib.offsetbox`` :: - from mpl_toolkits.axes_grid.anchored_artists import AnchoredText + from matplotlib.offsetbox import AnchoredText at = AnchoredText("Figure 1a", prop=dict(size=8), frameon=True, loc=2, @@ -220,7 +221,7 @@ drawing area. Note that the extents of the artists that are added to the drawing area has nothing to do with the placement of the drawing area itself. The initial size only matters. :: - from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea + from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea ada = AnchoredDrawingArea(20, 20, 0, 0, loc=1, pad=0., frameon=False) @@ -242,7 +243,7 @@ other coordinate than canvas pixel). You can use ``AnchoredDrawingArea`` except that the extent of the artist is determined during the drawing time respecting the specified transform. :: - from mpl_toolkits.axes_grid.anchored_artists import AnchoredAuxTransformBox + from mpl_toolkits.axes_grid1.anchored_artists import AnchoredAuxTransformBox box = AnchoredAuxTransformBox(ax.transData, loc=2) el = Ellipse((0,0), width=0.1, height=0.4, angle=30) # in data coordinates! @@ -375,7 +376,7 @@ Advanced Topics Zoom effect between Axes ======================== -mpl_toolkits.axes_grid.inset_locator defines some patch classes useful +``mpl_toolkits.axes_grid1.inset_locator`` defines some patch classes useful for interconnect two axes. Understanding the code requires some knowledge of how mpl's transform works. But, utilizing it will be straight forward. diff --git a/doc/users/plotting/examples/anchored_box01.py b/doc/users/plotting/examples/anchored_box01.py index 517a2f88d151..509e6acf0962 100644 --- a/doc/users/plotting/examples/anchored_box01.py +++ b/doc/users/plotting/examples/anchored_box01.py @@ -1,5 +1,5 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.anchored_artists import AnchoredText +from matplotlib.offsetbox import AnchoredText fig=plt.figure(1, figsize=(3,3)) ax = plt.subplot(111) diff --git a/doc/users/plotting/examples/anchored_box02.py b/doc/users/plotting/examples/anchored_box02.py index 6f8db6dd8de8..d2a2ed7b3e5c 100644 --- a/doc/users/plotting/examples/anchored_box02.py +++ b/doc/users/plotting/examples/anchored_box02.py @@ -1,6 +1,6 @@ from matplotlib.patches import Circle import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea +from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea fig=plt.figure(1, figsize=(3,3)) ax = plt.subplot(111) diff --git a/doc/users/plotting/examples/anchored_box03.py b/doc/users/plotting/examples/anchored_box03.py index 0848e1b9d270..371ec9f68052 100644 --- a/doc/users/plotting/examples/anchored_box03.py +++ b/doc/users/plotting/examples/anchored_box03.py @@ -1,6 +1,6 @@ from matplotlib.patches import Ellipse import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.anchored_artists import AnchoredAuxTransformBox +from mpl_toolkits.axes_grid1.anchored_artists import AnchoredAuxTransformBox fig=plt.figure(1, figsize=(3,3)) ax = plt.subplot(111) diff --git a/doc/users/plotting/examples/annotate_explain.py b/doc/users/plotting/examples/annotate_explain.py index 6dadbd5e541b..12cc94e2aa70 100644 --- a/doc/users/plotting/examples/annotate_explain.py +++ b/doc/users/plotting/examples/annotate_explain.py @@ -7,8 +7,8 @@ fig = plt.figure(1, figsize=(8,3)) fig.clf() -from mpl_toolkits.axes_grid.axes_grid import AxesGrid -from mpl_toolkits.axes_grid.anchored_artists import AnchoredText +from mpl_toolkits.axes_grid1.axes_grid import AxesGrid +from matplotlib.offsetbox import AnchoredText #from matplotlib.font_manager import FontProperties diff --git a/doc/users/plotting/examples/connectionstyle_demo.py b/doc/users/plotting/examples/connectionstyle_demo.py index baa68fab5ad0..86757f2104e6 100644 --- a/doc/users/plotting/examples/connectionstyle_demo.py +++ b/doc/users/plotting/examples/connectionstyle_demo.py @@ -4,8 +4,8 @@ fig = plt.figure(1, figsize=(8,5)) fig.clf() -from mpl_toolkits.axes_grid.axes_grid import AxesGrid -from mpl_toolkits.axes_grid.anchored_artists import AnchoredText +from mpl_toolkits.axes_grid1.axes_grid import AxesGrid +from matplotlib.offsetbox import AnchoredText #from matplotlib.font_manager import FontProperties diff --git a/doc/users/plotting/examples/demo_gridspec06.py b/doc/users/plotting/examples/demo_gridspec06.py index e1fbaf5c5f99..32084dfa960b 100644 --- a/doc/users/plotting/examples/demo_gridspec06.py +++ b/doc/users/plotting/examples/demo_gridspec06.py @@ -1,19 +1,7 @@ import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np - -try: - from itertools import product -except ImportError: - # product is new in v 2.6 - def product(*args, **kwds): - pools = map(tuple, args) * kwds.get('repeat', 1) - result = [[]] - for pool in pools: - result = [x+[y] for x in result for y in pool] - for prod in result: - yield tuple(prod) - +from itertools import product def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)): return np.sin(i*a)*np.cos(i*b), np.sin(i*c)*np.cos(i*d) @@ -50,4 +38,3 @@ def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)): ax.spines['right'].set_visible(True) plt.show() - diff --git a/doc/users/plotting/examples/simple_annotate01.py b/doc/users/plotting/examples/simple_annotate01.py index 434b09efa22e..eb99af25babd 100644 --- a/doc/users/plotting/examples/simple_annotate01.py +++ b/doc/users/plotting/examples/simple_annotate01.py @@ -7,8 +7,8 @@ fig = plt.figure(1) fig.clf() -from mpl_toolkits.axes_grid.axes_grid import Grid -from mpl_toolkits.axes_grid.anchored_artists import AnchoredText +from mpl_toolkits.axes_grid1.axes_grid import Grid +from matplotlib.offsetbox import AnchoredText from matplotlib.font_manager import FontProperties @@ -129,3 +129,4 @@ def add_at(ax, t, loc=2): #ax.set_xlim(0, 1) #ax.set_ylim(0, 1) plt.draw() +plt.show() diff --git a/doc/users/whats_new.rst b/doc/users/whats_new.rst index c1657092b6ce..ab6ab4f39b71 100644 --- a/doc/users/whats_new.rst +++ b/doc/users/whats_new.rst @@ -2111,8 +2111,9 @@ axes grid toolkit Jae-Joon Lee has added a new toolkit to ease displaying multiple images in matplotlib, as well as some support for curvilinear grids to support the world coordinate system. The toolkit is included standard with all -new mpl installs. See :ref:`axes_grid-examples-index` and -:ref:`axes_grid_users-guide-index`. +new mpl installs. See :ref:`axes_grid1-examples-index`, +:ref:`axisartist-examples-index`, :ref:`axes_grid1_users-guide-index` and +:ref:`axisartist_users-guide-index` .. plot:: pyplots/whats_new_99_axes_grid.py diff --git a/examples/README.txt b/examples/README.txt index 4cd6bafca2c2..cd1b6a8327ee 100644 --- a/examples/README.txt +++ b/examples/README.txt @@ -19,7 +19,9 @@ directories found here: * api - working with the matplotlib API directory. - * axes_grid - Examples related to the AxesGrid toolkit + * axes_grid1 - Examples related to the axes_grid1 toolkit + + * axisartist - Examples related to the axisartist toolkit * event_handling - how to interact with your figure, mouse presses, key presses, object picking, etc. diff --git a/examples/axes_grid/demo_axes_divider.py b/examples/axes_grid1/demo_axes_divider.py similarity index 100% rename from examples/axes_grid/demo_axes_divider.py rename to examples/axes_grid1/demo_axes_divider.py diff --git a/examples/axes_grid/demo_axes_grid.py b/examples/axes_grid1/demo_axes_grid.py similarity index 66% rename from examples/axes_grid/demo_axes_grid.py rename to examples/axes_grid1/demo_axes_grid.py index 7d74cc5072e5..01f78edbf927 100644 --- a/examples/axes_grid/demo_axes_grid.py +++ b/examples/axes_grid1/demo_axes_grid.py @@ -1,5 +1,5 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid1 import AxesGrid +from mpl_toolkits.axes_grid1 import ImageGrid def get_demo_image(): @@ -16,11 +16,11 @@ def demo_simple_grid(fig): A grid of 2x2 images with 0.05 inch pad between images and only the lower-left axes is labeled. """ - grid = AxesGrid(fig, 141, # similar to subplot(141) - nrows_ncols=(2, 2), - axes_pad=0.05, - label_mode="1", - ) + grid = ImageGrid(fig, 141, # similar to subplot(141) + nrows_ncols=(2, 2), + axes_pad=0.05, + label_mode="1", + ) Z, extent = get_demo_image() for i in range(4): @@ -36,19 +36,18 @@ def demo_grid_with_single_cbar(fig): """ A grid of 2x2 images with a single colorbar """ - grid = AxesGrid(fig, 142, # similar to subplot(142) - nrows_ncols=(2, 2), - axes_pad=0.0, - share_all=True, - label_mode="L", - cbar_location="top", - cbar_mode="single", - ) + grid = ImageGrid(fig, 142, # similar to subplot(142) + nrows_ncols=(2, 2), + axes_pad=0.0, + share_all=True, + label_mode="L", + cbar_location="top", + cbar_mode="single", + ) Z, extent = get_demo_image() for i in range(4): im = grid[i].imshow(Z, extent=extent, interpolation="nearest") - #plt.colorbar(im, cax = grid.cbar_axes[0]) grid.cbar_axes[0].colorbar(im) for cax in grid.cbar_axes: @@ -64,16 +63,16 @@ def demo_grid_with_each_cbar(fig): A grid of 2x2 images. Each image has its own colorbar. """ - grid = AxesGrid(fig, 143, # similar to subplot(143) - nrows_ncols=(2, 2), - axes_pad=0.1, - label_mode="1", - share_all=True, - cbar_location="top", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) + grid = ImageGrid(fig, 143, # similar to subplot(143) + nrows_ncols=(2, 2), + axes_pad=0.1, + label_mode="1", + share_all=True, + cbar_location="top", + cbar_mode="each", + cbar_size="7%", + cbar_pad="2%", + ) Z, extent = get_demo_image() for i in range(4): im = grid[i].imshow(Z, extent=extent, interpolation="nearest") @@ -92,16 +91,16 @@ def demo_grid_with_each_cbar_labelled(fig): A grid of 2x2 images. Each image has its own colorbar. """ - grid = AxesGrid(fig, 144, # similar to subplot(144) - nrows_ncols=(2, 2), - axes_pad=(0.45, 0.15), - label_mode="1", - share_all=True, - cbar_location="right", - cbar_mode="each", - cbar_size="7%", - cbar_pad="2%", - ) + grid = ImageGrid(fig, 144, # similar to subplot(144) + nrows_ncols=(2, 2), + axes_pad=(0.45, 0.15), + label_mode="1", + share_all=True, + cbar_location="right", + cbar_mode="each", + cbar_size="7%", + cbar_pad="2%", + ) Z, extent = get_demo_image() # Use a different colorbar range every time diff --git a/examples/axes_grid/demo_axes_grid2.py b/examples/axes_grid1/demo_axes_grid2.py similarity index 100% rename from examples/axes_grid/demo_axes_grid2.py rename to examples/axes_grid1/demo_axes_grid2.py diff --git a/examples/axes_grid/demo_axes_hbox_divider.py b/examples/axes_grid1/demo_axes_hbox_divider.py similarity index 100% rename from examples/axes_grid/demo_axes_hbox_divider.py rename to examples/axes_grid1/demo_axes_hbox_divider.py diff --git a/examples/axes_grid/demo_axes_rgb.py b/examples/axes_grid1/demo_axes_rgb.py similarity index 100% rename from examples/axes_grid/demo_axes_rgb.py rename to examples/axes_grid1/demo_axes_rgb.py diff --git a/examples/axes_grid/demo_colorbar_with_inset_locator.py b/examples/axes_grid1/demo_colorbar_with_inset_locator.py similarity index 100% rename from examples/axes_grid/demo_colorbar_with_inset_locator.py rename to examples/axes_grid1/demo_colorbar_with_inset_locator.py diff --git a/examples/axes_grid/demo_edge_colorbar.py b/examples/axes_grid1/demo_edge_colorbar.py similarity index 100% rename from examples/axes_grid/demo_edge_colorbar.py rename to examples/axes_grid1/demo_edge_colorbar.py diff --git a/examples/axes_grid/demo_imagegrid_aspect.py b/examples/axes_grid1/demo_imagegrid_aspect.py similarity index 100% rename from examples/axes_grid/demo_imagegrid_aspect.py rename to examples/axes_grid1/demo_imagegrid_aspect.py diff --git a/examples/axes_grid/inset_locator_demo.py b/examples/axes_grid1/inset_locator_demo.py similarity index 100% rename from examples/axes_grid/inset_locator_demo.py rename to examples/axes_grid1/inset_locator_demo.py diff --git a/examples/axes_grid/inset_locator_demo2.py b/examples/axes_grid1/inset_locator_demo2.py similarity index 100% rename from examples/axes_grid/inset_locator_demo2.py rename to examples/axes_grid1/inset_locator_demo2.py diff --git a/examples/axes_grid/make_room_for_ylabel_using_axesgrid.py b/examples/axes_grid1/make_room_for_ylabel_using_axesgrid.py similarity index 100% rename from examples/axes_grid/make_room_for_ylabel_using_axesgrid.py rename to examples/axes_grid1/make_room_for_ylabel_using_axesgrid.py diff --git a/examples/axes_grid/parasite_simple2.py b/examples/axes_grid1/parasite_simple2.py similarity index 100% rename from examples/axes_grid/parasite_simple2.py rename to examples/axes_grid1/parasite_simple2.py diff --git a/examples/axes_grid/scatter_hist.py b/examples/axes_grid1/scatter_hist.py similarity index 100% rename from examples/axes_grid/scatter_hist.py rename to examples/axes_grid1/scatter_hist.py diff --git a/examples/axes_grid/simple_anchored_artists.py b/examples/axes_grid1/simple_anchored_artists.py similarity index 100% rename from examples/axes_grid/simple_anchored_artists.py rename to examples/axes_grid1/simple_anchored_artists.py diff --git a/examples/axes_grid/simple_axesgrid.py b/examples/axes_grid1/simple_axesgrid.py similarity index 100% rename from examples/axes_grid/simple_axesgrid.py rename to examples/axes_grid1/simple_axesgrid.py diff --git a/examples/axes_grid/simple_axesgrid2.py b/examples/axes_grid1/simple_axesgrid2.py similarity index 100% rename from examples/axes_grid/simple_axesgrid2.py rename to examples/axes_grid1/simple_axesgrid2.py diff --git a/examples/axes_grid/simple_axisline4.py b/examples/axes_grid1/simple_axisline4.py similarity index 92% rename from examples/axes_grid/simple_axisline4.py rename to examples/axes_grid1/simple_axisline4.py index cac8fe0ccb94..b3bc3b4cd69a 100644 --- a/examples/axes_grid/simple_axisline4.py +++ b/examples/axes_grid1/simple_axisline4.py @@ -3,7 +3,7 @@ import mpl_toolkits.axisartist as AA import numpy as np -ax = host_subplot(111, axes_class=AA.Axes) +ax = host_subplot(111) xx = np.arange(0, 2*np.pi, 0.01) ax.plot(xx, np.sin(xx)) diff --git a/examples/axes_grid/demo_axisline_style.py b/examples/axisartist/demo_axisline_style.py similarity index 88% rename from examples/axes_grid/demo_axisline_style.py rename to examples/axisartist/demo_axisline_style.py index 3d0b0d6f5dab..a8e2c7ada5d7 100644 --- a/examples/axes_grid/demo_axisline_style.py +++ b/examples/axisartist/demo_axisline_style.py @@ -1,5 +1,5 @@ -from mpl_toolkits.axes_grid.axislines import SubplotZero +from mpl_toolkits.axisartist.axislines import SubplotZero import matplotlib.pyplot as plt import numpy as np diff --git a/examples/axes_grid/demo_curvelinear_grid.py b/examples/axisartist/demo_curvelinear_grid.py similarity index 100% rename from examples/axes_grid/demo_curvelinear_grid.py rename to examples/axisartist/demo_curvelinear_grid.py diff --git a/examples/axes_grid/demo_curvelinear_grid2.py b/examples/axisartist/demo_curvelinear_grid2.py similarity index 90% rename from examples/axes_grid/demo_curvelinear_grid2.py rename to examples/axisartist/demo_curvelinear_grid2.py index a1b105cefdf3..8d8e30a893db 100644 --- a/examples/axes_grid/demo_curvelinear_grid2.py +++ b/examples/axisartist/demo_curvelinear_grid2.py @@ -1,11 +1,11 @@ import numpy as np import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.grid_helper_curvelinear import \ +from mpl_toolkits.axisartist.grid_helper_curvelinear import \ GridHelperCurveLinear -from mpl_toolkits.axes_grid.axislines import Subplot +from mpl_toolkits.axisartist.axislines import Subplot -import mpl_toolkits.axes_grid.angle_helper as angle_helper +import mpl_toolkits.axisartist.angle_helper as angle_helper def curvelinear_test1(fig): diff --git a/examples/axes_grid/demo_floating_axes.py b/examples/axisartist/demo_floating_axes.py similarity index 100% rename from examples/axes_grid/demo_floating_axes.py rename to examples/axisartist/demo_floating_axes.py diff --git a/examples/axes_grid/demo_floating_axis.py b/examples/axisartist/demo_floating_axis.py similarity index 100% rename from examples/axes_grid/demo_floating_axis.py rename to examples/axisartist/demo_floating_axis.py diff --git a/examples/axes_grid/demo_parasite_axes2.py b/examples/axisartist/demo_parasite_axes2.py similarity index 100% rename from examples/axes_grid/demo_parasite_axes2.py rename to examples/axisartist/demo_parasite_axes2.py diff --git a/lib/mpl_toolkits/axes_grid/__init__.py b/lib/mpl_toolkits/axes_grid/__init__.py index acdd625bf452..c202eb7e1718 100644 --- a/lib/mpl_toolkits/axes_grid/__init__.py +++ b/lib/mpl_toolkits/axes_grid/__init__.py @@ -8,3 +8,10 @@ make_axes_locatable from .axes_grid import Grid, ImageGrid, AxesGrid #from axes_divider import make_axes_locatable +from matplotlib.cbook import warn_deprecated +warn_deprecated(since='2.1', + name='mpl_toolkits.axes_grid', + alternative='mpl_toolkits.axes_grid1 and' + ' mpl_toolkits.axisartist provies the same' + ' functionality', + obj_type='module') diff --git a/lib/mpl_toolkits/axisartist/axes_divider.py b/lib/mpl_toolkits/axisartist/axes_divider.py new file mode 100644 index 000000000000..9d05c639be93 --- /dev/null +++ b/lib/mpl_toolkits/axisartist/axes_divider.py @@ -0,0 +1,10 @@ +from __future__ import (absolute_import, division, print_function, + unicode_literals) + +from matplotlib.externals import six + +from mpl_toolkits.axes_grid1.axes_divider import Divider, AxesLocator, SubplotDivider, \ + AxesDivider, locatable_axes_factory, make_axes_locatable + +from mpl_toolkits.axes_grid.axislines import Axes +LocatableAxes = locatable_axes_factory(Axes) diff --git a/lib/mpl_toolkits/axisartist/axes_grid.py b/lib/mpl_toolkits/axisartist/axes_grid.py new file mode 100644 index 000000000000..96bc7bb7ad1e --- /dev/null +++ b/lib/mpl_toolkits/axisartist/axes_grid.py @@ -0,0 +1,32 @@ +from __future__ import (absolute_import, division, print_function, + unicode_literals) + +from matplotlib.externals import six + +import mpl_toolkits.axes_grid1.axes_grid as axes_grid_orig +from .axes_divider import LocatableAxes + +class CbarAxes(axes_grid_orig.CbarAxesBase, LocatableAxes): + def __init__(self, *kl, **kwargs): + orientation=kwargs.pop("orientation", None) + if orientation is None: + raise ValueError("orientation must be specified") + self.orientation = orientation + self._default_label_on = False + self.locator = None + + super(LocatableAxes, self).__init__(*kl, **kwargs) + + def cla(self): + super(LocatableAxes, self).cla() + self._config_axes() + + +class Grid(axes_grid_orig.Grid): + _defaultLocatableAxesClass = LocatableAxes + +class ImageGrid(axes_grid_orig.ImageGrid): + _defaultLocatableAxesClass = LocatableAxes + _defaultCbarAxesClass = CbarAxes + +AxesGrid = ImageGrid diff --git a/lib/mpl_toolkits/axisartist/axes_rgb.py b/lib/mpl_toolkits/axisartist/axes_rgb.py new file mode 100644 index 000000000000..d433928804b3 --- /dev/null +++ b/lib/mpl_toolkits/axisartist/axes_rgb.py @@ -0,0 +1,13 @@ +from __future__ import (absolute_import, division, print_function, + unicode_literals) + +from matplotlib.externals import six + +#from mpl_toolkits.axes_grid1.axes_rgb import * +from mpl_toolkits.axes_grid1.axes_rgb import make_rgb_axes, imshow_rgb, RGBAxesBase + +#import mpl_toolkits.axes_grid1.axes_rgb as axes_rgb_orig +from .axislines import Axes + +class RGBAxes(RGBAxesBase): + _defaultAxesClass = Axes diff --git a/lib/mpl_toolkits/axisartist/parasite_axes.py b/lib/mpl_toolkits/axisartist/parasite_axes.py new file mode 100644 index 000000000000..7c77482e6853 --- /dev/null +++ b/lib/mpl_toolkits/axisartist/parasite_axes.py @@ -0,0 +1,20 @@ +from __future__ import (absolute_import, division, print_function, + unicode_literals) + +from matplotlib.externals import six + +from mpl_toolkits.axes_grid1.parasite_axes import \ + subplot_class_factory, \ + parasite_axes_class_factory, parasite_axes_auxtrans_class_factory, \ + host_axes_class_factory + +from .axislines import Axes + + +ParasiteAxes = parasite_axes_class_factory(Axes) + +ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(axes_class=ParasiteAxes) + +HostAxes = host_axes_class_factory(axes_class=Axes) + +SubplotHost = subplot_class_factory(HostAxes)