Skip to content

Commit 518afd8

Browse files
committed
Merge remote-tracking branch 'upstream/v1.3.x'
Conflicts: lib/matplotlib/text.py setup.py
2 parents febea19 + e4ec9d5 commit 518afd8

File tree

9 files changed

+116
-15
lines changed

9 files changed

+116
-15
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ doc/_templates/gallery.html
5454
doc/users/installing.rst
5555
doc/_static/matplotlibrc
5656
lib/dateutil
57+
examples/*/*.pdf
58+
examples/*/*.png
59+
examples/tests/*
60+
!examples/tests/backend_driver.py
61+
texput.log
62+
result_images

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ script:
3535
- python ../matplotlib/tests.py -sv --processes=8 --process-timeout=300
3636

3737
after_failure:
38-
- cd ../matplotlib
3938
- tar cjf result_images.tar.bz2 result_images
4039
- travis-artifacts upload --path result_images.tar.bz2
4140
- echo https://s3.amazonaws.com/matplotlib-test-results/artifacts/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/result_images.tar.bz2

doc/api/api_changes.rst

+14-4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ original location:
8383
Changes in 1.3.x
8484
================
8585

86+
Changes in 1.3.1
87+
----------------
88+
89+
It is rare that we make an API change in a bugfix release, however,
90+
for 1.3.1 since 1.3.0 the following change was made:
91+
92+
- `text.Text.cached` (used to cache font objects) has been made into a
93+
private variable. Among the obvious encapsulation benefit, this
94+
removes this confusing-looking member from the documentation.
95+
96+
- The method :meth:`~matplotlib.axes.Axes.hist` now always returns bin
97+
occupancies as an array of type `float`. Previously, it was sometimes
98+
an array of type `int`, depending on the call.
99+
86100
Code removal
87101
------------
88102

@@ -263,10 +277,6 @@ Code changes
263277
* The :func:`matplotlib.cbook.check_output` function has been moved to
264278
:func:`matplotlib.compat.subprocess`.
265279

266-
* The method :meth:`~matplotlib.axes.Axes.hist` now always returns bin
267-
occupancies as an array of type `float`. Previously, it was sometimes
268-
an array of type `int`, depending on the call.
269-
270280
Configuration and rcParams
271281
--------------------------
272282

doc/users/whats_new.rst

+68
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,74 @@ to a non-transparent background.
5858
new in matplotlib-1.3
5959
=====================
6060

61+
New in 1.3.1
62+
------------
63+
64+
1.3.1 is a bugfix release, primarily dealing with improved setup and
65+
handling of dependencies, and correcting and enhancing the
66+
documentation.
67+
68+
The following changes were made in 1.3.1 since 1.3.0.
69+
70+
Enhancements
71+
````````````
72+
73+
- Added a context manager for creating multi-page pdfs (see
74+
`matplotlib.backends.backend_pdf.PdfPages`).
75+
76+
- The WebAgg backend should no have lower latency over heterogeneous
77+
Internet connections.
78+
79+
Bug fixes
80+
`````````
81+
82+
- Histogram plots now contain the endline.
83+
84+
- Fixes to the Molleweide projection.
85+
86+
- Handling recent fonts from Microsoft and Macintosh-style fonts with
87+
non-ascii metadata is improved.
88+
89+
- Hatching of fill between plots now works correctly in the PDF
90+
backend.
91+
92+
- Tight bounding box support now works in the PGF backend.
93+
94+
- Transparent figures now display correctly in the Qt4Agg backend.
95+
96+
- Drawing lines from one subplot to another now works.
97+
98+
- Unit handling on masked arrays has been improved.
99+
100+
Setup and dependencies
101+
``````````````````````
102+
103+
- Now works with any version of pyparsing 1.5.6 or later, without displaying
104+
hundreds of warnings.
105+
106+
- Now works with 64-bit versions of Ghostscript on MS-Windows.
107+
108+
- When installing from source into an environment without Numpy, Numpy
109+
will first be downloaded and built and then used to build
110+
matplotlib.
111+
112+
- Externally installed backends are now always imported using a
113+
fully-qualified path to the module.
114+
115+
- Works with newer version of wxPython.
116+
117+
- Can now build with a PyCXX installed globally on the system from source.
118+
119+
- Better detection of Gtk3 dependencies.
120+
121+
Testing
122+
```````
123+
124+
- Tests should now work in non-English locales.
125+
126+
- PEP8 conformance tests now report on locations of issues.
127+
128+
61129
New plotting features
62130
---------------------
63131

lib/matplotlib/backends/backend_qt4agg.py

+6
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,16 @@ def paintEvent(self, e):
116116

117117
refcnt = sys.getrefcount(stringBuffer)
118118

119+
# convert the Agg rendered image -> qImage
119120
qImage = QtGui.QImage(stringBuffer, self.renderer.width,
120121
self.renderer.height,
121122
QtGui.QImage.Format_ARGB32)
123+
# get the rectangle for the image
124+
rect = qImage.rect()
122125
p = QtGui.QPainter(self)
126+
# reset the image area of the canvas to be the back-ground color
127+
p.eraseRect(rect)
128+
# draw the rendered image on to the canvas
123129
p.drawPixmap(QtCore.QPoint(0, 0), QtGui.QPixmap.fromImage(qImage))
124130

125131
# draw the zoom rectangle to the QPainter

lib/matplotlib/colors.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,10 @@ def __call__(self, value, clip=None):
906906

907907
self.autoscale_None(result)
908908
vmin, vmax = self.vmin, self.vmax
909-
if vmin > vmax:
910-
raise ValueError("minvalue must be less than or equal to maxvalue")
911-
elif vmin == vmax:
909+
if vmin == vmax:
912910
result.fill(0) # Or should it be all masked? Or 0.5?
911+
elif vmin > vmax:
912+
raise ValueError("minvalue must be less than or equal to maxvalue")
913913
else:
914914
vmin = float(vmin)
915915
vmax = float(vmax)
@@ -947,9 +947,9 @@ def autoscale(self, A):
947947

948948
def autoscale_None(self, A):
949949
' autoscale only None-valued vmin or vmax'
950-
if self.vmin is None:
950+
if self.vmin is None and np.size(A) > 0:
951951
self.vmin = ma.min(A)
952-
if self.vmax is None:
952+
if self.vmax is None and np.size(A) > 0:
953953
self.vmax = ma.max(A)
954954

955955
def scaled(self):

lib/matplotlib/tests/test_colors.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import matplotlib.colors as mcolors
1212
import matplotlib.cm as cm
1313
import matplotlib.pyplot as plt
14-
from matplotlib.testing.decorators import image_comparison
14+
from matplotlib.testing.decorators import image_comparison, cleanup
1515

1616

1717
def test_colormap_endian():
@@ -179,6 +179,14 @@ def test_cmap_and_norm_from_levels_and_colors2():
179179
assert_raises(ValueError, mcolors.from_levels_and_colors, levels, colors)
180180

181181

182+
@cleanup
183+
def test_autoscale_masked():
184+
# Test for #2336. Previously fully masked data would trigger a ValueError.
185+
data = np.ma.masked_all((12, 20))
186+
plt.pcolor(data)
187+
plt.draw()
188+
189+
182190
if __name__ == '__main__':
183191
import nose
184192
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

lib/matplotlib/text.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class Text(Artist):
151151
"""
152152
zorder = 3
153153

154-
cached = maxdict(50)
154+
_cached = maxdict(50)
155155

156156
def __str__(self):
157157
return "Text(%g,%g,%s)" % (self._x, self._y, repr(self._text))
@@ -290,8 +290,8 @@ def _get_layout(self, renderer):
290290
of a rotated text when necessary.
291291
"""
292292
key = self.get_prop_tup()
293-
if key in self.cached:
294-
return self.cached[key]
293+
if key in self._cached:
294+
return self._cached[key]
295295

296296
horizLayout = []
297297

@@ -445,7 +445,7 @@ def get_text_width_height_descent(*kl, **kwargs):
445445
xs, ys = xys[:, 0], xys[:, 1]
446446

447447
ret = bbox, list(zip(lines, whs, xs, ys)), descent
448-
self.cached[key] = ret
448+
self._cached[key] = ret
449449
return ret
450450

451451
def set_bbox(self, rectprops):

setup.py

+4
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@
207207
mod.extra_compile_args.append('-DVERBOSE')
208208

209209

210+
extra_args = {}
211+
210212
# Finally, pass this all along to distutils to do the heavy lifting.
211213
distrib = setup(
212214
name="matplotlib",
@@ -240,4 +242,6 @@
240242
# Telling setuptools this prevents it from doing an automatic
241243
# check for zip safety.
242244
zip_safe=False,
245+
246+
**extra_args
243247
)

0 commit comments

Comments
 (0)