diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 4495ccdf9497..2d1476ef696f 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1088,8 +1088,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w', self.figure.set_facecolor(origfacecolor) self.figure.set_edgecolor(origedgecolor) self.figure.set_canvas(self) - self.figure.canvas.draw() - + #self.figure.canvas.draw() ## seems superfluous return result def get_default_filetype(self): @@ -1509,7 +1508,7 @@ def release_zoom(self, event): if not self._xypress: return last_a = [] - + for cur_xypress in self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = cur_xypress @@ -1528,7 +1527,7 @@ def release_zoom(self, event): x, y = inverse.transform_point( (x, y) ) Xmin,Xmax=a.get_xlim() Ymin,Ymax=a.get_ylim() - + # detect twinx,y axes and avoid double zooming twinx, twiny = False, False if last_a: diff --git a/lib/matplotlib/backends/backend_agg.py b/lib/matplotlib/backends/backend_agg.py index 0e80ec051f97..3cb0e8f2dfb3 100644 --- a/lib/matplotlib/backends/backend_agg.py +++ b/lib/matplotlib/backends/backend_agg.py @@ -59,8 +59,7 @@ def __init__(self, width, height, dpi): self.width = width self.height = height if __debug__: verbose.report('RendererAgg.__init__ width=%s, height=%s'%(width, height), 'debug-annoying') - self._renderer = _RendererAgg(int(width), int(height), dpi, - debug=False) + self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False) if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done', 'debug-annoying') self.draw_path = self._renderer.draw_path diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index 66eaf00f3867..df54a21af3c9 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -1438,8 +1438,8 @@ def hpack(self, w=0., m='additional'): w: specifies a width m: is either 'exactly' or 'additional'. - Thus, hpack(w, exactly) produces a box whose width is exactly w, while - hpack (w, additional ) yields a box whose width is the natural width + Thus, hpack(w, 'exactly') produces a box whose width is exactly w, while + hpack (w, 'additional') yields a box whose width is the natural width plus w. The default values produce a box with the natural width. node644, node649""" # I don't know why these get reset in TeX. Shift_amount is pretty @@ -1502,8 +1502,8 @@ def vpack(self, h=0., m='additional', l=float(inf)): m: is either 'exactly' or 'additional'. l: a maximum height - Thus, vpack(h, exactly) produces a box whose width is exactly w, while - vpack(w, additional) yields a box whose width is the natural width + Thus, vpack(h, 'exactly') produces a box whose width is exactly w, while + vpack(w, 'additional') yields a box whose width is the natural width plus w. The default values produce a box with the natural width. node644, node668""" # I don't know why these get reset in TeX. Shift_amount is pretty @@ -2678,7 +2678,6 @@ def __init__(self, output): def parse(self, s, dpi = 72, prop = None): if prop is None: prop = FontProperties() - cacheKey = (s, dpi, hash(prop)) result = self._cache.get(cacheKey) if result is not None: diff --git a/lib/matplotlib/quiver.py b/lib/matplotlib/quiver.py index 803459329401..94b694ef093e 100644 --- a/lib/matplotlib/quiver.py +++ b/lib/matplotlib/quiver.py @@ -168,20 +168,24 @@ def __init__(self, Q, X, Y, U, label, **kw): self.coord = kw.pop('coordinates', 'axes') self.color = kw.pop('color', None) self.label = label - self.labelsep = (kw.pop('labelsep', 0.1) * Q.ax.figure.dpi) + self._labelsep_inches = kw.pop('labelsep', 0.1) + self.labelsep = (self._labelsep_inches * Q.ax.figure.dpi) def on_dpi_change(fig): - self.labelsep = (kw.pop('labelsep', 0.1) * fig.dpi) + self.labelsep = (self._labelsep_inches * fig.dpi) + self._initialized = False # simple brute force update + # works because _init is called + # at the start of draw. Q.ax.figure.callbacks.connect('dpi_changed', on_dpi_change) - self.labelpos = kw.pop('labelpos', 'N') self.labelcolor = kw.pop('labelcolor', None) self.fontproperties = kw.pop('fontproperties', dict()) self.kw = kw _fp = self.fontproperties - self.text = text.Text(text=label, + #boxprops = dict(facecolor='red') + self.text = text.Text(text=label, # bbox=boxprops, horizontalalignment=self.halign[self.labelpos], verticalalignment=self.valign[self.labelpos], fontproperties=font_manager.FontProperties(**_fp)) @@ -297,6 +301,16 @@ def __init__(self, ax, *args, **kw): self.keyvec = None self.keytext = None + def on_dpi_change(fig): + self._new_UV = True # vertices depend on width, span + # which in turn depend on dpi + self._initialized = False # simple brute force update + # works because _init is called + # at the start of draw. + + self.ax.figure.callbacks.connect('dpi_changed', on_dpi_change) + + __init__.__doc__ = """ The constructor takes one required argument, an Axes instance, followed by the args and kwargs described @@ -331,7 +345,8 @@ def _init(self): if not self._initialized: trans = self._set_transform() ax = self.ax - sx, sy = trans.inverted().transform_point((ax.bbox.width, ax.bbox.height)) + sx, sy = trans.inverted().transform_point( + (ax.bbox.width, ax.bbox.height)) self.span = sx sn = max(8, min(25, math.sqrt(self.N))) if self.width is None: diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index f26c5abf0edc..8e88d8869d57 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1174,7 +1174,6 @@ def update_positions(self, renderer): if self.arrowprops: x0, y0 = x, y l,b,w,h = self.get_window_extent(renderer).bounds - dpi = self.figure.dpi r = l+w t = b+h xc = 0.5*(l+r)