diff --git a/.travis.yml b/.travis.yml
index dbb5c9e81f96..cdea1adc3c15 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -77,20 +77,13 @@ install:
pip install --upgrade setuptools
- |
# Install dependencies from pypi
- pip install $PRE python-dateutil $NUMPY pyparsing!=2.1.6 $PANDAS pep8 cycler coveralls coverage
+ pip install $PRE python-dateutil $NUMPY pyparsing!=2.1.6 $PANDAS pep8 cycler coveralls coverage $MOCK
pip install $PRE -r doc-requirements.txt
# Install nose from a build which has partial
# support for python36 and suport for coverage output suppressing
pip install git+https://github.com/jenshnielsen/nose.git@matplotlibnose
- # Install mock on python 2. Python 2.6 requires mock 1.0.1
- # Since later versions have dropped support
- - |
- if [[ -n "$MOCK" ]]; then
- echo $MOCK
- pip install $MOCK
- fi;
# We manually install humor sans using the package from Ubuntu 14.10. Unfortunatly humor sans is not
# availible in the Ubuntu version used by Travis but we can manually install the deb from a later
# version since is it basically just a .ttf file
diff --git a/doc/users/whats_new/2015-11-05_hidpi.rst b/doc/users/whats_new/2015-11-05_hidpi.rst
new file mode 100644
index 000000000000..6a0ed6ea9fe7
--- /dev/null
+++ b/doc/users/whats_new/2015-11-05_hidpi.rst
@@ -0,0 +1,5 @@
+Support for HiDPI (Retina) displays in the NbAgg and WebAgg backends
+--------------------------------------------------------------------
+
+The NbAgg and WebAgg backends will now use the full resolution of your
+high-pixel-density display.
diff --git a/doc/users/whats_new/boxplot_zorder_kwarg.rst b/doc/users/whats_new/boxplot_zorder_kwarg.rst
new file mode 100644
index 000000000000..bbb44aa59ee8
--- /dev/null
+++ b/doc/users/whats_new/boxplot_zorder_kwarg.rst
@@ -0,0 +1,11 @@
+Boxplot Zorder Keyword Argument
+-------------------------------
+
+The ``zorder`` parameter now exists for :func:`boxplot`. This allows the zorder
+of a boxplot to be set in the plotting function call.
+
+Example
+```````
+::
+
+ boxplot(np.arange(10), zorder=10)
diff --git a/examples/pie_and_polar_charts/polar_scatter_demo.py b/examples/pie_and_polar_charts/polar_scatter_demo.py
index db8ece939887..71992f3c458c 100644
--- a/examples/pie_and_polar_charts/polar_scatter_demo.py
+++ b/examples/pie_and_polar_charts/polar_scatter_demo.py
@@ -1,8 +1,8 @@
"""
Demo of scatter plot on a polar axis.
-Size increases radially in this example and color increases with angle (just to
-verify the symbols are being scattered correctly).
+Size increases radially in this example and color increases with angle
+(just to verify the symbols are being scattered correctly).
"""
import numpy as np
import matplotlib.pyplot as plt
@@ -11,11 +11,11 @@
N = 150
r = 2 * np.random.rand(N)
theta = 2 * np.pi * np.random.rand(N)
-area = 200 * r**2 * np.random.rand(N)
+area = 200 * r**2
colors = theta
ax = plt.subplot(111, projection='polar')
-c = plt.scatter(theta, r, c=colors, s=area, cmap=plt.cm.hsv)
+c = ax.scatter(theta, r, c=colors, s=area, cmap=plt.cm.hsv)
c.set_alpha(0.75)
plt.show()
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
index 3f992e8e0aff..e29bee400649 100644
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
@@ -1528,7 +1528,14 @@ def tk_window_focus():
]
-def verify_test_dependencies():
+def _init_tests():
+ try:
+ import faulthandler
+ except ImportError:
+ pass
+ else:
+ faulthandler.enable()
+
if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'tests')):
raise ImportError("matplotlib test data is not installed")
@@ -1563,37 +1570,36 @@ def verify_test_dependencies():
raise
+def _get_extra_test_plugins():
+ from .testing.noseclasses import KnownFailure
+ from nose.plugins import attrib
+
+ return [KnownFailure, attrib.Plugin]
+
+
def test(verbosity=1):
"""run the matplotlib test suite"""
- verify_test_dependencies()
- try:
- import faulthandler
- except ImportError:
- pass
- else:
- faulthandler.enable()
+ _init_tests()
old_backend = rcParams['backend']
try:
use('agg')
import nose
import nose.plugins.builtin
- from .testing.noseclasses import KnownFailure
from nose.plugins.manager import PluginManager
from nose.plugins import multiprocess
# store the old values before overriding
- plugins = []
- plugins.append(KnownFailure())
+ plugins = _get_extra_test_plugins()
plugins.extend([plugin() for plugin in nose.plugins.builtin.plugins])
- manager = PluginManager(plugins=plugins)
+ manager = PluginManager(plugins=[x() for x in plugins])
config = nose.config.Config(verbosity=verbosity, plugins=manager)
# Nose doesn't automatically instantiate all of the plugins in the
# child processes, so we have to provide the multiprocess plugin with
# a list.
- multiprocess._instantiate_plugins = [KnownFailure]
+ multiprocess._instantiate_plugins = plugins
success = nose.run(
defaultTest=default_test_modules,
diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py
index a60ed1d9700a..c7f89c6b0403 100644
--- a/lib/matplotlib/axes/_axes.py
+++ b/lib/matplotlib/axes/_axes.py
@@ -1565,38 +1565,43 @@ def semilogx(self, *args, **kwargs):
"""
Make a plot with log scaling on the *x* axis.
- Call signature::
-
- semilogx(*args, **kwargs)
-
- :func:`semilogx` supports all the keyword arguments of
- :func:`~matplotlib.pyplot.plot` and
- :meth:`matplotlib.axes.Axes.set_xscale`.
-
- Notable keyword arguments:
-
- *basex*: scalar > 1
- Base of the *x* logarithm
+ Parameters
+ ----------
+ basex : float, optional
+ Base of the *x* logarithm. The scalar should be larger
+ than 1.
- *subsx*: [ *None* | sequence ]
+ subsx : array_like, optional
The location of the minor xticks; *None* defaults to
autosubs, which depend on the number of decades in the
plot; see :meth:`~matplotlib.axes.Axes.set_xscale` for
details.
- *nonposx*: [ 'mask' | 'clip' ]
+ nonposx : string, optional, {'mask', 'clip'}
Non-positive values in *x* can be masked as
- invalid, or clipped to a very small positive number
+ invalid, or clipped to a very small positive number.
- The remaining valid kwargs are
+ Returns
+ -------
+ `~matplotlib.pyplot.plot`
+ Log-scaled plot on the *x* axis.
+
+ Other Parameters
+ ----------------
:class:`~matplotlib.lines.Line2D` properties:
%(Line2D)s
- .. seealso::
+ See Also
+ --------
+ loglog : For example code and figure.
+
+ Notes
+ -----
+ This function supports all the keyword arguments of
+ :func:`~matplotlib.pyplot.plot` and
+ :meth:`matplotlib.axes.Axes.set_xscale`.
- :meth:`loglog`
- For example code and figure
"""
if not self._hold:
self.cla()
@@ -3110,7 +3115,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
showbox=None, showfliers=None, boxprops=None,
labels=None, flierprops=None, medianprops=None,
meanprops=None, capprops=None, whiskerprops=None,
- manage_xticks=True, autorange=False):
+ manage_xticks=True, autorange=False, zorder=None):
"""
Make a box and whisker plot.
@@ -3123,7 +3128,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
showbox=True, showfliers=True, boxprops=None,
labels=None, flierprops=None, medianprops=None,
meanprops=None, capprops=None, whiskerprops=None,
- manage_xticks=True, autorange=False):
+ manage_xticks=True, autorange=False, zorder=None):
Make a box and whisker plot for each column of ``x`` or each
vector in sequence ``x``. The box extends from the lower to
@@ -3235,6 +3240,9 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
``shownotches`` is also True. Otherwise, means will be shown
as points.
+ zorder : scalar, optional (None)
+ Sets the zorder of the boxplot.
+
Other Parameters
----------------
showcaps : bool, optional (True)
@@ -3409,7 +3417,7 @@ def _update_dict(dictionary, rc_name, properties):
medianprops=medianprops, meanprops=meanprops,
meanline=meanline, showfliers=showfliers,
capprops=capprops, whiskerprops=whiskerprops,
- manage_xticks=manage_xticks)
+ manage_xticks=manage_xticks, zorder=zorder)
return artists
def bxp(self, bxpstats, positions=None, widths=None, vert=True,
@@ -3417,7 +3425,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
showcaps=True, showbox=True, showfliers=True,
boxprops=None, whiskerprops=None, flierprops=None,
medianprops=None, capprops=None, meanprops=None,
- meanline=False, manage_xticks=True):
+ meanline=False, manage_xticks=True, zorder=None):
"""
Drawing function for box and whisker plots.
@@ -3428,7 +3436,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
showcaps=True, showbox=True, showfliers=True,
boxprops=None, whiskerprops=None, flierprops=None,
medianprops=None, capprops=None, meanprops=None,
- meanline=False, manage_xticks=True):
+ meanline=False, manage_xticks=True, zorder=None):
Make a box and whisker plot for each column of *x* or each
vector in sequence *x*. The box extends from the lower to
@@ -3532,6 +3540,9 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
manage_xticks : bool, default = True
If the function should adjust the xlim and xtick locations.
+ zorder : scalar, default = None
+ The zorder of the resulting boxplot
+
Returns
-------
result : dict
@@ -3574,7 +3585,10 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
# empty list of xticklabels
datalabels = []
- zorder = mlines.Line2D.zorder
+ # Use default zorder if none specified
+ if zorder is None:
+ zorder = mlines.Line2D.zorder
+
zdelta = 0.1
# box properties
if patch_artist:
diff --git a/lib/matplotlib/backends/backend_agg.py b/lib/matplotlib/backends/backend_agg.py
index 0a26650164a3..ff7ccb461a1b 100644
--- a/lib/matplotlib/backends/backend_agg.py
+++ b/lib/matplotlib/backends/backend_agg.py
@@ -38,6 +38,7 @@
from matplotlib.mathtext import MathTextParser
from matplotlib.path import Path
from matplotlib.transforms import Bbox, BboxBase
+from matplotlib import colors as mcolors
from matplotlib.backends._backend_agg import RendererAgg as _RendererAgg
from matplotlib import _png
@@ -571,7 +572,6 @@ def print_to_buffer(self):
return result
if _has_pil:
-
# add JPEG support
def print_jpg(self, filename_or_obj, *args, **kwargs):
"""
@@ -593,14 +593,21 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
buf, size = self.print_to_buffer()
if kwargs.pop("dryrun", False):
return
+ # The image is "pasted" onto a white background image to safely
+ # handle any transparency
image = Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
+ color = mcolors.colorConverter.to_rgb(
+ rcParams.get('savefig.facecolor', 'white'))
+ color = tuple([int(x * 255.0) for x in color])
+ background = Image.new('RGB', size, color)
+ background.paste(image, image)
options = restrict_dict(kwargs, ['quality', 'optimize',
'progressive'])
if 'quality' not in options:
options['quality'] = rcParams['savefig.jpeg_quality']
- return image.save(filename_or_obj, format='jpeg', **options)
+ return background.save(filename_or_obj, format='jpeg', **options)
print_jpeg = print_jpg
# add TIFF support
diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py
index a7837b10aa13..45e9f3973f43 100644
--- a/lib/matplotlib/font_manager.py
+++ b/lib/matplotlib/font_manager.py
@@ -594,6 +594,9 @@ def createFontList(fontfiles, fontext='ttf'):
verbose.report("Cannot handle unicode filenames")
# print >> sys.stderr, 'Bad file is', fpath
continue
+ except IOError:
+ verbose.report("IO error - cannot open font file %s" % fpath)
+ continue
try:
prop = ttfFontProperty(font)
except (KeyError, RuntimeError, ValueError):
diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py
index 21ac10486c85..0a84030162aa 100644
--- a/lib/matplotlib/mathtext.py
+++ b/lib/matplotlib/mathtext.py
@@ -2656,11 +2656,12 @@ def symbol(self, s, loc, toks):
# Do not space commas between brackets
if c == ',':
+ prev_char, next_char = '', ''
for i in six.moves.xrange(1, loc + 1):
prev_char = s[loc - i]
if prev_char != ' ':
break
- for i in six.moves.xrange(1, loc + 1):
+ for i in six.moves.xrange(1, len(s) - loc):
next_char = s[loc + i]
if next_char != ' ':
break
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.pdf
index cedb7c898fd1..8e44f24eba2f 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.pdf and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.png
index a54eedcc5eb9..09147448dcb8 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.png and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.svg
index 3f5fcb8a823b..61ee84791179 100644
--- a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.svg
+++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_80.svg
@@ -18,23 +18,8 @@ z
" style="fill:#ffffff;"/>
-
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.pdf
index c456bf519d60..e63cf1cf468b 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.pdf and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.png
index 77f201ad7e79..e172fd1b879c 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.png and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.svg
index ed538515d234..416380a2707f 100644
--- a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.svg
+++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavusans_80.svg
@@ -18,8 +18,23 @@ z
" style="fill:#ffffff;"/>
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.pdf
index dda13decf161..1836c097a257 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.pdf and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.png
index ae52bed06cb5..d2b3cecb441a 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.png and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.svg
index f02f17f8eede..4ee11299dd0e 100644
--- a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.svg
+++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_dejavuserif_80.svg
@@ -18,8 +18,28 @@ z
" style="fill:#ffffff;"/>
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.pdf
index 22f414b598f2..af60e108b0f1 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.pdf and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.png
index 1b8a075f997c..c0a9a2577e7e 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.png and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.svg
index 5f6c111c106d..ec5f382a1cbf 100644
--- a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.svg
+++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stix_80.svg
@@ -18,8 +18,33 @@ z
" style="fill:#ffffff;"/>
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.pdf b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.pdf
index eb6a537b9262..e6484938b079 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.pdf and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.pdf differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.png b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.png
index 1e0daf1e9293..02a1ed4873cc 100644
Binary files a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.png and b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.png differ
diff --git a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.svg b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.svg
index baf25a7400bf..906d64164637 100644
--- a/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.svg
+++ b/lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_stixsans_80.svg
@@ -18,18 +18,8 @@ z
" style="fill:#ffffff;"/>
-
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py
index 54e8c6aec82f..1c2b1ecd7083 100644
--- a/lib/matplotlib/tests/test_axes.py
+++ b/lib/matplotlib/tests/test_axes.py
@@ -2031,6 +2031,14 @@ def test_boxplot_bad_ci_1():
conf_intervals=[[1, 2]])
+@cleanup
+def test_boxplot_zorder():
+ x = np.arange(10)
+ fix, ax = plt.subplots()
+ assert ax.boxplot(x)['boxes'][0].get_zorder() == 2
+ assert ax.boxplot(x, zorder=10)['boxes'][0].get_zorder() == 10
+
+
@cleanup
def test_boxplot_bad_ci_2():
x = np.linspace(-7, 7, 140)
diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py
index f2d5fb019010..d9bccee46b23 100644
--- a/lib/matplotlib/tests/test_image.py
+++ b/lib/matplotlib/tests/test_image.py
@@ -15,7 +15,7 @@
from matplotlib.image import (BboxImage, imread, NonUniformImage,
AxesImage, FigureImage, PcolorImage)
from matplotlib.transforms import Bbox, Affine2D, TransformedBbox
-from matplotlib import rcParams
+from matplotlib import rcParams, rc_context
from matplotlib import patches
import matplotlib.pyplot as plt
@@ -35,7 +35,6 @@
try:
from PIL import Image
- del Image
HAS_PIL = True
except ImportError:
HAS_PIL = False
@@ -494,6 +493,34 @@ def test_nonuniformimage_setnorm():
im.set_norm(plt.Normalize())
+@knownfailureif(not HAS_PIL)
+@cleanup
+def test_jpeg_alpha():
+ plt.figure(figsize=(1, 1), dpi=300)
+ # Create an image that is all black, with a gradient from 0-1 in
+ # the alpha channel from left to right.
+ im = np.zeros((300, 300, 4), dtype=float)
+ im[..., 3] = np.linspace(0.0, 1.0, 300)
+
+ plt.figimage(im)
+
+ buff = io.BytesIO()
+ with rc_context({'savefig.facecolor': 'red'}):
+ plt.savefig(buff, transparent=True, format='jpg', dpi=300)
+
+ buff.seek(0)
+ image = Image.open(buff)
+
+ # If this fails, there will be only one color (all black). If this
+ # is working, we should have all 256 shades of grey represented.
+ num_colors = len(image.getcolors(256))
+ assert 175 <= num_colors <= 185, 'num colors: %d' % (num_colors, )
+ # The fully transparent part should be red, not white or black
+ # or anything else
+ corner_pixel = image.getpixel((0, 0))
+ assert corner_pixel == (254, 0, 0), "corner pixel: %r" % (corner_pixel, )
+
+
@cleanup
def test_nonuniformimage_setdata():
ax = plt.gca()
diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py
index fe3fe18ac4ce..38762987cd9a 100644
--- a/lib/matplotlib/tests/test_mathtext.py
+++ b/lib/matplotlib/tests/test_mathtext.py
@@ -105,7 +105,7 @@
' '.join('$\\' + p + '$' for p in sorted(mathtext.Parser._snowflake)),
r'$6-2$; $-2$; $ -2$; ${-2}$; ${ -2}$; $20^{+3}_{-2}$',
r'$\overline{\omega}^x \frac{1}{2}_0^x$', # github issue #5444
- r'$1{,}234{, }567{ , }890$ and $1,234,567,890$', # github issue 5799
+ r'$,$ $.$ $1{,}234{, }567{ , }890$ and $1,234,567,890$', # github issue 5799
]
digits = "0123456789"
diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py
index ff0a71d156d2..a88e47c1551c 100644
--- a/lib/matplotlib/ticker.py
+++ b/lib/matplotlib/ticker.py
@@ -6,7 +6,7 @@
locating and formatting. Although the locators know nothing about major
or minor ticks, they are used by the Axis class to support major and
minor tick locating and formatting. Generic tick locators and
-formatters are provided, as well as domain specific custom ones..
+formatters are provided, as well as domain specific custom ones.
Default Formatter
@@ -80,6 +80,9 @@
tick interval into a specified number of minor intervals,
defaulting to 4 or 5 depending on the major interval.
+:class:`LogitLocator`
+ Locator for logit scaling.
+
There are a number of locators specialized for date locations - see
the dates module
@@ -132,8 +135,18 @@
:class:`LogFormatter`
Formatter for log axes
-:class:`EngFormatter`
- Format labels in engineering notation
+:class:`LogFormatterExponent`
+ Format values for log axis using ``exponent = log_base(value)``.
+
+:class:`LogFormatterMathtext`
+ Format values for log axis using ``exponent = log_base(value)``
+ using Math text.
+
+:class:`LogFormatterSciNotation`
+ Format values for log axis using scientific notation.
+
+:class:`LogitFormatter`
+ Probability formatter.
You can derive your own formatter from the Formatter base class by
diff --git a/tests.py b/tests.py
index 30fab2adbeeb..94b0b1bb8d70 100755
--- a/tests.py
+++ b/tests.py
@@ -17,30 +17,19 @@
matplotlib.use('agg')
import nose
-from nose.plugins import attrib
-from matplotlib.testing.noseclasses import KnownFailure
from matplotlib import default_test_modules
-plugins = [KnownFailure, attrib.Plugin]
-
-# Nose doesn't automatically instantiate all of the plugins in the
-# child processes, so we have to provide the multiprocess plugin with
-# a list.
-from nose.plugins import multiprocess
-multiprocess._instantiate_plugins = plugins
-
def run(extra_args):
- try:
- import faulthandler
- except ImportError:
- pass
- else:
- faulthandler.enable()
+ from nose.plugins import multiprocess
+
+ matplotlib._init_tests()
- if not os.path.isdir(
- os.path.join(os.path.dirname(matplotlib.__file__), 'tests')):
- raise ImportError("matplotlib test data is not installed")
+ # Nose doesn't automatically instantiate all of the plugins in the
+ # child processes, so we have to provide the multiprocess plugin with
+ # a list.
+ plugins = matplotlib._get_extra_test_plugins()
+ multiprocess._instantiate_plugins = plugins
nose.main(addplugins=[x() for x in plugins],
defaultTest=default_test_modules,