Skip to content

Backport PR #9517 on branch v2.1.x #9525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b619345
Backport PR #9392: Add examples for subplots_axes_and_figures
dstansby Oct 14, 2017
e92003c
Merge pull request #9400 from matplotlib/auto-backport-of-pr-9392
tacaswell Oct 15, 2017
5346830
Backport PR #9394: [Doc] Add pcolor, contour, imshow to and other sm…
NelleV Oct 14, 2017
17b41ae
Merge pull request #9405 from matplotlib/auto-backport-of-pr-9394
tacaswell Oct 15, 2017
8a40bc6
Backport PR #9254: imshow transparency blend example
NelleV Oct 15, 2017
0bbde92
Merge pull request #9413 from matplotlib/auto-backport-of-pr-9254
tacaswell Oct 15, 2017
22735cb
Backport PR #9408: updating color cycle tutorial
NelleV Oct 15, 2017
cf2751f
DOC: point python intersphinx at python3 docs
tacaswell Oct 16, 2017
563762a
DOC: https for pandas intersphinx
tacaswell Oct 16, 2017
44978f2
Backport PR #9420: Trivial doc fixes.
dstansby Oct 16, 2017
6a56e5d
Merge pull request #9417 from matplotlib/auto-backport-of-pr-9408
dstansby Oct 16, 2017
e2d4093
Merge pull request #9422 from tacaswell/doc_intersphinx_target
NelleV Oct 16, 2017
0d021b1
Merge pull request #9433 from matplotlib/auto-backport-of-pr-9420
dstansby Oct 17, 2017
02b434e
Backport PR #9378: DOC: fill out dev docs
dstansby Oct 18, 2017
4552534
Merge pull request #9470 from matplotlib/auto-backport-of-pr-9378
dopplershift Oct 18, 2017
deae074
Backport PR #9447: Update examples for axisgrid1
jklymak Oct 19, 2017
9c9a33f
Backport PR #9483: DOC Demote container headings one level Artist tut…
anntzer Oct 19, 2017
1619578
Backport PR #9478: Added description to widget example programs excep…
NelleV Oct 21, 2017
98e204c
Backport PR #9286: Ask Appveyor to ignore certain branches.
tacaswell Oct 5, 2017
3c4c14b
Merge pull request #9507 from matplotlib/auto-backport-of-pr-9286
tacaswell Oct 21, 2017
e5604ac
Merge pull request #9502 from matplotlib/auto-backport-of-pr-9483
tacaswell Oct 21, 2017
13f912f
Merge pull request #9501 from matplotlib/auto-backport-of-pr-9447
tacaswell Oct 21, 2017
4ba4766
Merge pull request #9503 from matplotlib/auto-backport-of-pr-9478
tacaswell Oct 21, 2017
6a18d6b
Backport PR #9396: Fix minor bug in vertex insert
tacaswell Oct 21, 2017
5f14f49
Merge pull request #9509 from matplotlib/auto-backport-of-pr-9396
tacaswell Oct 22, 2017
7f1945e
Backport PR #9506: fix typo in rst markup
tacaswell Oct 22, 2017
c6c3002
Backport PR #9508: CI: do not run pushes to the auto-backport branches
tacaswell Oct 22, 2017
8ed0f15
Merge pull request #9512 from matplotlib/auto-backport-of-pr-9508
dstansby Oct 22, 2017
10070f4
Merge pull request #9511 from matplotlib/auto-backport-of-pr-9506
dstansby Oct 22, 2017
7ccf0db
Backport PR #9517: Convert slider docstrings to numpydoc
NelleV Oct 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# https://github.com/rmcgibbo/python-appveyor-conda-example

# Backslashes in quotes need to be escaped: \ -> "\\"
branches:
except:
- /auto-backport-.*/

environment:

Expand Down
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ language: python
dist: trusty
sudo: false

branches:
except:
- /^auto-backport-of-pr-\d*/

cache:
pip: true
directories:
Expand Down
10 changes: 5 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ def _check_deps():
autodoc_default_flags = ['members', 'undoc-members']

intersphinx_mapping = {
'python': ('https://docs.python.org/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None)
}
'python': ('https://docs.python.org/3', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None)
}

explicit_order_folders = [
'../examples/api',
Expand Down
25 changes: 19 additions & 6 deletions doc/devel/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ use to organize this information.

Thank you for your help in keeping bug reports complete, targeted and descriptive.

.. _installing_for_devs:

Retrieving and installing the latest version of the code
========================================================

Expand Down Expand Up @@ -84,17 +86,28 @@ you can use ``git@`` instead of ``https://``, which works through the ssh proto
and might be easier to use if you are using 2-factor authentication.


To make sure the tests run locally you must build against the correct version
of freetype. To configure the build system to fetch and build it either export
the env ``MPLLOCALFREETYPE`` as::
Building Matplotlib for image comparison tests
----------------------------------------------

export MPLLOCALFREETYPE=1
Matplotlib's test suite makes heavy use of image comparison tests,
meaning the result of a plot is compared against a known good result.
Unfortunately, different versions of FreeType produce differently
formed characters, causing these image comparisons to fail. To make
them reproducible, Matplotlib can be built with a special local copy
of FreeType. This is recommended for all Matplotlib developers.

or copy :file:`setup.cfg.template` to :file:`setup.cfg` and edit it to contain
::
Copy :file:`setup.cfg.template` to :file:`setup.cfg` and edit it to contain::

[test]
local_freetype = True
tests = True

or set the ``MPLLOCALFREETYPE`` environmental variable to any true
value.


Installing Matplotlib in developer mode
---------------------------------------

To install Matplotlib (and compile the c-extensions) run the following
command from the top-level directory ::
Expand Down
31 changes: 7 additions & 24 deletions doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ infrastructure are in :mod:`matplotlib.testing`.
Requirements
------------

Install the latest version of Matplotlib as documented in
:ref:`installing_for_devs` In particular, follow the instructions to use a
local FreeType build

The following software is required to run the tests:

- pytest_, version 3.0.0 or later
Expand All @@ -35,26 +39,6 @@ Optionally you can install:
- pytest-xdist_ to run tests in parallel


Building matplotlib for image comparison tests
----------------------------------------------

matplotlib's test suite makes heavy use of image comparison tests,
meaning the result of a plot is compared against a known good result.
Unfortunately, different versions of FreeType produce differently
formed characters, causing these image comparisons to fail. To make
them reproducible, matplotlib can be built with a special local copy
of FreeType. This is recommended for all matplotlib developers.

Add the following content to a ``setup.cfg`` file at the root of the
matplotlib source directory::

[test]
local_freetype = True
tests = True

or by setting the ``MPLLOCALFREETYPE`` environmental variable to any true
value.

Running the tests
-----------------

Expand Down Expand Up @@ -164,8 +148,7 @@ Writing an image based test is only slightly more difficult than a
simple test. The main consideration is that you must specify the
"baseline", or expected, images in the
:func:`~matplotlib.testing.decorators.image_comparison` decorator. For
example, this test generates a single image and automatically tests
it::
example, this test generates a single image and automatically tests it::

import numpy as np
import matplotlib
Expand Down Expand Up @@ -262,13 +245,13 @@ repository <https://github.com/matplotlib/matplotlib/>`_ -- for
example, see `its Travis page
<https://travis-ci.org/matplotlib/matplotlib>`_.

If you want to enable Travis CI for your personal matplotlib GitHub
If you want to enable Travis CI for your personal Matplotlib GitHub
repo, simply enable the repo to use Travis CI in either the Travis CI
UI or the GitHub UI (Admin | Service Hooks). For details, see `the
Travis CI Getting Started page
<https://docs.travis-ci.com/user/getting-started/>`_. This
generally isn't necessary, since any pull request submitted against
the main matplotlib repository will be tested.
the main Matplotlib repository will be tested.

Once this is configured, you can see the Travis CI results at
https://travis-ci.org/your_GitHub_user_name/matplotlib -- here's `an
Expand Down
26 changes: 12 additions & 14 deletions doc/faq/osx_framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ Working with Matplotlib on OSX
Introduction
============

On OSX, two different types of Python Builds exist: a regular build and a
framework build. In order to interact correctly with OSX through the native
GUI frameworks you need a framework build of Python.
At the time of writing the ``macosx`` and ``WXAgg`` backends require a
framework build to function correctly. This can result in issues for
a python installation not build as a framework and may also happen in
virtual envs and when using (Ana)Conda.
From Matplotlib 1.5 onwards the ``macosx`` backend
checks that a framework build is available and fails if a non framework
build is found. WX has a similar check build in.
On OSX, two different types of Python builds exist: a regular build and a
framework build. In order to interact correctly with OSX through the native
GUI frameworks you need a framework build of Python. At the time of writing
the ``macosx`` and ``WXAgg`` backends require a framework build to function
correctly. This can result in issues for a Python installation not build as a
framework and may also happen in virtual envs and when using (Ana)Conda. From
Matplotlib 1.5 onwards, both backends check that a framework build is available
and fail if a non framework build is found.

Without this check a partially functional figure is created.
Among the issues with it is that it is produced in the background and
Expand Down Expand Up @@ -103,9 +101,9 @@ build within the virtual environment you can do ``frameworkpython -m IPython``
``PYTHONHOME`` and Jupyter
^^^^^^^^^^^^^^^^^^^^^^^^^^

This approach can be followed even if using `Jupyter <https://jupyter.org/>`_
notebooks: you just need to setup a kernel with the suitable ``PYTHONHOME``
definition. The `jupyter-virtualenv-osx <https://github.com/mapio/jupyter-virtualenv-osx>`_
This approach can be followed even if using `Jupyter <https://jupyter.org/>`_
notebooks: you just need to setup a kernel with the suitable ``PYTHONHOME``
definition. The `jupyter-virtualenv-osx <https://github.com/mapio/jupyter-virtualenv-osx>`_
script automates the creation of such a kernel.


Expand Down Expand Up @@ -139,7 +137,7 @@ With this in place you can run ``frameworkpython`` as above but will need to add
to every virtualenv

PythonW Compiler
^^^^^^^^^^^^^^^^
----------------

In addition
`virtualenv-pythonw-osx <https://github.com/gldnspud/virtualenv-pythonw-osx>`_
Expand Down
8 changes: 0 additions & 8 deletions doc/faq/virtualenv_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
Working with Matplotlib in Virtual environments
***********************************************

.. contents::
:backlinks: none

.. _virtualenv_introduction:

Introduction
============

When running Matplotlib in a `virtual environment
<https://virtualenv.pypa.io/en/latest/>`_ you may discover a few issues.
Matplotlib itself has no issue with virtual environments. However, some of
Expand Down
4 changes: 2 additions & 2 deletions doc/users/prev_whats_new/whats_new_1.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ You can even multiply cyclers, which is like using `itertools.product()`
on two or more property cycles. Remember to use parentheses if writing
a multi-line `prop_cycle` parameter.

.. figure:: ../../gallery/color/images/sphx_glr_color_cycle_001.png
:target: ../../gallery/color/color_cycle.html
.. figure:: ../../tutorials/intermediate/images/sphx_glr_color_cycle_001.png
:target: ../../tutorials/intermediate/color_cycle.html
:align: center
:scale: 50

Expand Down
55 changes: 37 additions & 18 deletions examples/animation/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
Animated histogram
==================

This example shows how to use a path patch to draw a bunch of
rectangles for an animated histogram.
Use a path patch to draw a bunch of rectangles for an animated histogram.

"""
import numpy as np
Expand All @@ -14,8 +13,6 @@
import matplotlib.path as path
import matplotlib.animation as animation

fig, ax = plt.subplots()

# Fixing random state for reproducibility
np.random.seed(19680801)

Expand All @@ -30,13 +27,23 @@
top = bottom + n
nrects = len(left)

# here comes the tricky part -- we have to set up the vertex and path
# codes arrays using moveto, lineto and closepoly

# for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the
# CLOSEPOLY; the vert for the closepoly is ignored but we still need
# it to keep the codes aligned with the vertices
nverts = nrects*(1 + 3 + 1)
###############################################################################
# Here comes the tricky part -- we have to set up the vertex and path codes
# arrays using ``plt.Path.MOVETO``, ``plt.Path.LINETO`` and
# ``plt.Path.CLOSEPOLY`` for each rect.
#
# * We need 1 ``MOVETO`` per rectangle, which sets the initial point.
# * We need 3 ``LINETO``'s, which tell Matplotlib to draw lines from
# vertex 1 to vertex 2, v2 to v3, and v3 to v4.
# * We then need one ``CLOSEPOLY`` which tells Matplotlib to draw a line from
# the v4 to our initial vertex (the ``MOVETO`` vertex), in order to close the
# polygon.
#
# .. note::
#
# The vertex for ``CLOSEPOLY`` is ignored, but we still need a placeholder
# in the ``verts`` array to keep the codes aligned with the vertices.
nverts = nrects * (1 + 3 + 1)
verts = np.zeros((nverts, 2))
codes = np.ones(nverts, int) * path.Path.LINETO
codes[0::5] = path.Path.MOVETO
Expand All @@ -50,13 +57,12 @@
verts[3::5, 0] = right
verts[3::5, 1] = bottom

barpath = path.Path(verts, codes)
patch = patches.PathPatch(
barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
ax.add_patch(patch)

ax.set_xlim(left[0], right[-1])
ax.set_ylim(bottom.min(), top.max())
###############################################################################
# To animate the histogram, we need an ``animate`` function, which generates
# a random set of numbers and updates the locations of the vertices for the
# histogram (in this case, only the heights of each rectangle). ``patch`` will
# eventually be a ``Patch`` object.
patch = None


def animate(i):
Expand All @@ -68,5 +74,18 @@ def animate(i):
verts[2::5, 1] = top
return [patch, ]

###############################################################################
# And now we build the `Path` and `Patch` instances for the histogram using
# our vertices and codes. We add the patch to the `Axes` instance, and setup
# the `FuncAnimation` with our animate function.
fig, ax = plt.subplots()
barpath = path.Path(verts, codes)
patch = patches.PathPatch(
barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
ax.add_patch(patch)

ax.set_xlim(left[0], right[-1])
ax.set_ylim(bottom.min(), top.max())

ani = animation.FuncAnimation(fig, animate, 100, repeat=False, blit=True)
plt.show()
2 changes: 2 additions & 0 deletions examples/axes_grid1/demo_axes_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Demo Axes Divider
=================

Axes divider to calculate location of axes and
create a divider for them using exisiting axes instances.
"""
import matplotlib.pyplot as plt

Expand Down
1 change: 1 addition & 0 deletions examples/axes_grid1/demo_axes_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Demo Axes Grid
==============

Grid of 2x2 images with single or own colorbar.
"""
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
Expand Down
1 change: 1 addition & 0 deletions examples/axes_grid1/demo_axes_grid2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Demo Axes Grid2
===============

Grid of images with shared xaxis and yaxis.
"""
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
Expand Down
1 change: 1 addition & 0 deletions examples/axes_grid1/demo_axes_hbox_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Demo Axes Hbox Divider
======================

Hbox Divider to arrange subplots.
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
1 change: 1 addition & 0 deletions examples/axes_grid1/demo_axes_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Demo Axes RGB
=============
RGBAxes to show RGB composite images.
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
20 changes: 10 additions & 10 deletions examples/event_handling/poly_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def draw_callback(self, event):
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
self.ax.draw_artist(self.poly)
self.ax.draw_artist(self.line)
self.canvas.blit(self.ax.bbox)
# do not need to blit here, this will fire before the screen is
# updated

def poly_changed(self, poly):
'this method is called whenever the polygon object is called'
Expand Down Expand Up @@ -114,9 +115,8 @@ def key_press_callback(self, event):
elif event.key == 'd':
ind = self.get_ind_under_point(event)
if ind is not None:
self.poly.xy = [tup
for i, tup in enumerate(self.poly.xy)
if i != ind]
self.poly.xy = np.delete(self.poly.xy,
ind, axis=0)
self.line.set_data(zip(*self.poly.xy))
elif event.key == 'i':
xys = self.poly.get_transform().transform(self.poly.xy)
Expand All @@ -126,14 +126,14 @@ def key_press_callback(self, event):
s1 = xys[i + 1]
d = dist_point_to_segment(p, s0, s1)
if d <= self.epsilon:
self.poly.xy = np.array(
list(self.poly.xy[:i]) +
[(event.xdata, event.ydata)] +
list(self.poly.xy[i:]))
self.poly.xy = np.insert(
self.poly.xy, i+1,
[event.xdata, event.ydata],
axis=0)
self.line.set_data(zip(*self.poly.xy))
break

self.canvas.draw()
if self.line.stale:
self.canvas.draw_idle()

def motion_notify_callback(self, event):
'on mouse movement'
Expand Down
Loading