Skip to content

Commit 96ecf45

Browse files
committed
Merge remote-tracking branch 'upstream/v1.2.x'
2 parents e2a29a4 + 4fad114 commit 96ecf45

18 files changed

+3461
-2777
lines changed

doc/api/api_changes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Changes in 1.3.x
2222
Changes in 1.2.x
2323
================
2424

25+
* The ``classic`` option of the rc parameter ``toolbar`` is deprecated
26+
and will be removed in the next release.
27+
2528
* The :meth:`~matplotlib.cbook.isvector` method has been removed since it
2629
is no longer functional.
2730

doc/faq/troubleshooting_faq.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,22 @@ environment variable -- see
6262

6363
.. _reporting-problems:
6464

65-
Report a problem
66-
================
65+
Getting help
66+
============
6767

68-
If you are having a problem with matplotlib, search the mailing
69-
lists first: there's a good chance someone else has already run into
70-
your problem.
68+
There are a number of good resources for getting help with matplotlib.
69+
There is a good chance your question has already been asked:
7170

72-
If not, please provide the following information in your e-mail to the
71+
- The `mailing list
72+
<http://sourceforge.net/search/?group_id=80706&type_of_search=mlists>`_.
73+
74+
- `Github issues <https://github.com/matplotlib/matplotlib/issues>`_.
75+
76+
- Stackoverflow questions tagged `matplotlib
77+
<http://stackoverflow.com/questions/tagged/matplotlib>`_.
78+
79+
If you are unable to find an answer to your question through search,
80+
please provide the following information in your e-mail to the
7381
`mailing list
7482
<http://lists.sourceforge.net/mailman/listinfo/matplotlib-users>`_:
7583

lib/matplotlib/axes.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ def ticklabel_format(self, **kwargs):
22052205
*scilimits* (m, n), pair of integers; if *style*
22062206
is 'sci', scientific notation will
22072207
be used for numbers outside the range
2208-
10`-m`:sup: to 10`n`:sup:.
2208+
10`m`:sup: to 10`n`:sup:.
22092209
Use (0,0) to include all numbers.
22102210
*useOffset* [True | False | offset]; if True,
22112211
the offset will be calculated as needed;
@@ -7364,6 +7364,20 @@ def pcolor(self, *args, **kwargs):
73647364

73657365
x = X.compressed()
73667366
y = Y.compressed()
7367+
7368+
# Transform from native to data coordinates?
7369+
t = collection._transform
7370+
if (not isinstance(t, mtransforms.Transform)
7371+
and hasattr(t, '_as_mpl_transform')):
7372+
t = t._as_mpl_transform(self.axes)
7373+
7374+
if t and any(t.contains_branch_seperately(self.transData)):
7375+
trans_to_data = t - self.transData
7376+
pts = np.vstack([x, y]).T.astype(np.float)
7377+
transformed_pts = trans_to_data.transform(pts)
7378+
x = transformed_pts[..., 0]
7379+
y = transformed_pts[..., 1]
7380+
73677381
minx = np.amin(x)
73687382
maxx = np.amax(x)
73697383
miny = np.amin(y)
@@ -7490,6 +7504,19 @@ def pcolormesh(self, *args, **kwargs):
74907504
collection.autoscale_None()
74917505

74927506
self.grid(False)
7507+
7508+
# Transform from native to data coordinates?
7509+
t = collection._transform
7510+
if (not isinstance(t, mtransforms.Transform)
7511+
and hasattr(t, '_as_mpl_transform')):
7512+
t = t._as_mpl_transform(self.axes)
7513+
7514+
if t and any(t.contains_branch_seperately(self.transData)):
7515+
trans_to_data = t - self.transData
7516+
pts = np.vstack([X, Y]).T.astype(np.float)
7517+
transformed_pts = trans_to_data.transform(pts)
7518+
X = transformed_pts[..., 0]
7519+
Y = transformed_pts[..., 1]
74937520

74947521
minx = np.amin(X)
74957522
maxx = np.amax(X)
@@ -8072,7 +8099,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
80728099
# so that each histogram uses the same bins
80738100
m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)
80748101
if mlast is None:
8075-
mlast = np.zeros(len(bins)-1, np.int)
8102+
mlast = np.zeros(len(bins)-1, m.dtype)
80768103
if normed:
80778104
db = np.diff(bins)
80788105
m = (m.astype(float) / db) / m.sum()

lib/matplotlib/backends/backend_qt4.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,7 @@ def set_message( self, s ):
603603

604604
def set_cursor( self, cursor ):
605605
if DEBUG: print('Set cursor' , cursor)
606-
QtGui.QApplication.restoreOverrideCursor()
607-
QtGui.QApplication.setOverrideCursor( QtGui.QCursor( cursord[cursor] ) )
606+
self.canvas.manager.window.setCursor(cursord[cursor])
608607

609608
def draw_rubberband( self, event, x0, y0, x1, y1 ):
610609
height = self.canvas.figure.bbox.height

lib/matplotlib/backends/backend_qt4agg.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from __future__ import division, print_function
55

66
import os, sys
7+
import ctypes
78

89
import matplotlib
910
from matplotlib.figure import Figure
@@ -15,6 +16,10 @@
1516

1617
DEBUG = False
1718

19+
_decref = ctypes.pythonapi.Py_DecRef
20+
_decref.argtypes = [ctypes.py_object]
21+
_decref.restype = None
22+
1823

1924
def new_figure_manager( num, *args, **kwargs ):
2025
"""
@@ -95,6 +100,8 @@ def paintEvent( self, e ):
95100
else:
96101
stringBuffer = self.renderer._renderer.tostring_argb()
97102

103+
refcnt = sys.getrefcount(stringBuffer)
104+
98105
qImage = QtGui.QImage(stringBuffer, self.renderer.width,
99106
self.renderer.height,
100107
QtGui.QImage.Format_ARGB32)
@@ -106,6 +113,14 @@ def paintEvent( self, e ):
106113
p.setPen( QtGui.QPen( QtCore.Qt.black, 1, QtCore.Qt.DotLine ) )
107114
p.drawRect( self.rect[0], self.rect[1], self.rect[2], self.rect[3] )
108115
p.end()
116+
117+
# This works around a bug in PySide 1.1.2 on Python 3.x,
118+
# where the reference count of stringBuffer is incremented
119+
# but never decremented by QImage.
120+
# TODO: revert PR #1323 once the issue is fixed in PySide.
121+
del qImage
122+
if refcnt != sys.getrefcount(stringBuffer):
123+
_decref(stringBuffer)
109124
else:
110125
bbox = self.blitbox
111126
l, b, r, t = bbox.extents

lib/matplotlib/backends/backend_svg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,8 @@ def print_svg(self, filename, *args, **kwargs):
10951095
svgwriter = io.TextIOWrapper(filename, 'utf-8')
10961096
else:
10971097
svgwriter = codecs.getwriter('utf-8')(filename)
1098+
else:
1099+
svgwriter = filename
10981100
fh_to_close = None
10991101
else:
11001102
raise ValueError("filename must be a path or a file-like object")

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2654,7 +2654,7 @@ def hist(x, bins=10, range=None, normed=False, weights=None, cumulative=False,
26542654
weights=weights, cumulative=cumulative, bottom=bottom,
26552655
histtype=histtype, align=align, orientation=orientation,
26562656
rwidth=rwidth, log=log, color=color, label=label,
2657-
**kwargs)
2657+
stacked=stacked, **kwargs)
26582658
draw_if_interactive()
26592659
finally:
26602660
ax.hold(washold)

lib/matplotlib/rcsetup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,17 @@ def validate_backend(s):
110110

111111
validate_qt4 = ValidateInStrings('backend.qt4', ['PyQt4', 'PySide'])
112112

113-
validate_toolbar = ValidateInStrings('toolbar',[
114-
'None','classic','toolbar2',
115-
], ignorecase=True)
113+
def validate_toolbar(s):
114+
validator = ValidateInStrings(
115+
'toolbar',
116+
['None','classic','toolbar2'],
117+
ignorecase=True)
118+
s = validator(s)
119+
if s.lower == 'classic':
120+
warnings.warn("'classic' Navigation Toolbar "
121+
"is deprecated in v1.2.x and will be "
122+
"removed in v1.3")
123+
return s
116124

117125
def validate_maskedarray(v):
118126
# 2008/12/12: start warning; later, remove all traces of maskedarray

lib/matplotlib/table.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ def contains(self, mouseevent):
267267
boxes = [self._cells[pos].get_window_extent(self._cachedRenderer)
268268
for pos in self._cells.iterkeys()
269269
if pos[0] >= 0 and pos[1] >= 0]
270-
# FIXME bbox_all is not defined.
271-
bbox = bbox_all(boxes)
270+
bbox = Bbox.union(boxes)
272271
return bbox.contains(mouseevent.x, mouseevent.y), {}
273272
else:
274273
return False, {}
@@ -281,8 +280,7 @@ def get_children(self):
281280
def get_window_extent(self, renderer):
282281
'Return the bounding box of the table in window coords'
283282
boxes = [c.get_window_extent(renderer) for c in self._cells]
284-
# FIXME bbox_all is not defined
285-
return bbox_all(boxes)
283+
return Bbox.union(boxes)
286284

287285
def _do_cell_alignment(self):
288286
""" Calculate row heights and column widths.
Binary file not shown.

0 commit comments

Comments
 (0)