Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v1.3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Apr 8, 2014
2 parents 64384a3 + 99d5012 commit 599500c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
18 changes: 17 additions & 1 deletion lib/matplotlib/backends/backend_qt4agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ def __init__(self, figure):
self.rect = []
self.blitbox = None
self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent)
# it has been reported that Qt is semi-broken in a windows
# environment. If `self.draw()` uses `update` to trigger a
# system-level window repaint (as is explicitly advised in the
# Qt documentation) the figure responds very slowly to mouse
# input. The work around is to directly use `repaint`
# (against the advice of the Qt documentation). The
# difference between `update` and repaint is that `update`
# schedules a `repaint` for the next time the system is idle,
# where as `repaint` repaints the window immediately. The
# risk is if `self.draw` gets called with in another `repaint`
# method there will be an infinite recursion. Thus, we only
# expose windows users to this risk.
if sys.platform.startswith('win'):
self._priv_update = self.repaint
else:
self._priv_update = self.update

def drawRectangle(self, rect):
self.rect = rect
Expand Down Expand Up @@ -154,7 +170,7 @@ def draw(self):
# causes problems with code that uses the result of the
# draw() to update plot elements.
FigureCanvasAgg.draw(self)
self.update()
self._priv_update()

def blit(self, bbox=None):
"""
Expand Down
23 changes: 21 additions & 2 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def set_size_inches(self, *args, **kwargs):
"""
set_size_inches(w,h, forward=False)
Set the figure size in inches
Set the figure size in inches (1in == 2.54cm)
Usage::
Expand All @@ -653,6 +653,11 @@ def set_size_inches(self, *args, **kwargs):
from the shell
ACCEPTS: a w,h tuple with w,h in inches
See Also
--------
:func:`~matplotlib.Figure.get_size_inches`
"""

forward = kwargs.get('forward', False)
Expand All @@ -673,7 +678,21 @@ def set_size_inches(self, *args, **kwargs):
manager.resize(int(canvasw), int(canvash))

def get_size_inches(self):
return self.bbox_inches.p1
"""
Returns the current size of the figure in inches (1in == 2.54cm)
as an numpy array.
Returns
-------
size : ndarray
The size of the figure in inches
See Also
--------
:func:`~matplotlib.Figure.set_size_inches`
"""
return np.array(self.bbox_inches.p1)

def get_edgecolor(self):
'Get the edge color of the Figure rectangle'
Expand Down

0 comments on commit 599500c

Please sign in to comment.