Revision: 5079
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5079&view=rev
Author: efiring
Date: 2008-04-27 00:55:03 -0700 (Sun, 27 Apr 2008)
Log Message:
-----------
Handle changed dpi in quiver; remove extra draw in print_figure.
There is still a dpi-related problem with mathtext in the QuiverKey label.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
trunk/matplotlib/lib/matplotlib/mathtext.py
trunk/matplotlib/lib/matplotlib/quiver.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-04-27 02:27:01 UTC
(rev 5078)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-04-27 07:55:03 UTC
(rev 5079)
@@ -1088,8 +1088,7 @@
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 @@
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 @@
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:
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-04-27
02:27:01 UTC (rev 5078)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-04-27
07:55:03 UTC (rev 5079)
@@ -59,8 +59,7 @@
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
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-04-27 02:27:01 UTC (rev
5078)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-04-27 07:55:03 UTC (rev
5079)
@@ -1438,8 +1438,8 @@
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 @@
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 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:
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-04-27 02:27:01 UTC (rev
5078)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-04-27 07:55:03 UTC (rev
5079)
@@ -168,20 +168,24 @@
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 @@
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 @@
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:
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2008-04-27 02:27:01 UTC (rev
5078)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-04-27 07:55:03 UTC (rev
5079)
@@ -1174,7 +1174,6 @@
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)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins