You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jd...@us...> - 2008-05-29 21:38:00
|
Revision: 5311
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5311&view=rev
Author: jdh2358
Date: 2008-05-29 14:37:55 -0700 (Thu, 29 May 2008)
Log Message:
-----------
added path editor
Modified Paths:
--------------
trunk/matplotlib/examples/api/path_patch_demo.py
Added Paths:
-----------
trunk/matplotlib/examples/event_handling/path_editor.py
Modified: trunk/matplotlib/examples/api/path_patch_demo.py
===================================================================
--- trunk/matplotlib/examples/api/path_patch_demo.py 2008-05-29 21:12:59 UTC (rev 5310)
+++ trunk/matplotlib/examples/api/path_patch_demo.py 2008-05-29 21:37:55 UTC (rev 5311)
@@ -5,6 +5,9 @@
Path = mpath.Path
+fig = plt.figure()
+ax = fig.add_subplot(111)
+
pathdata = [
(Path.MOVETO, (0, 0)),
(Path.CURVE4, (-1, 0)),
@@ -19,13 +22,10 @@
codes, verts = zip(*pathdata)
path = mpath.Path(verts, codes)
-
patch = mpatches.PathPatch(path, facecolor='green', edgecolor='yellow', alpha=0.5)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
ax.add_patch(patch)
+
ax.set_xlim(-5,5)
ax.set_ylim(-5,5)
Added: trunk/matplotlib/examples/event_handling/path_editor.py
===================================================================
--- trunk/matplotlib/examples/event_handling/path_editor.py (rev 0)
+++ trunk/matplotlib/examples/event_handling/path_editor.py 2008-05-29 21:37:55 UTC (rev 5311)
@@ -0,0 +1,145 @@
+import numpy as np
+import matplotlib.path as mpath
+import matplotlib.patches as mpatches
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
+
+Path = mpath.Path
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+
+pathdata = [
+ (Path.MOVETO, (0, 0)),
+ (Path.CURVE4, (-1, 0.1)),
+ (Path.CURVE4, (-1, 0.9)),
+ (Path.CURVE4, (0, 1)),
+ (Path.LINETO, (2, 1)),
+ (Path.CURVE4, (3, 0.9)),
+ (Path.CURVE4, (3, 0.1)),
+ (Path.CURVE4, (2, 0)),
+ (Path.CLOSEPOLY, (0, 0)),
+ ]
+
+codes, verts = zip(*pathdata)
+path = mpath.Path(verts, codes)
+patch = mpatches.PathPatch(path, facecolor='green', edgecolor='yellow', alpha=0.5)
+ax.add_patch(patch)
+
+
+class PathInteractor:
+ """
+ An path editor.
+
+ Key-bindings
+
+ 't' toggle vertex markers on and off. When vertex markers are on,
+ you can move them, delete them
+
+
+ """
+
+ showverts = True
+ epsilon = 5 # max pixel distance to count as a vertex hit
+
+ def __init__(self, pathpatch):
+
+ self.ax = pathpatch.axes
+ canvas = self.ax.figure.canvas
+ self.pathpatch = pathpatch
+ self.pathpatch.set_animated(True)
+
+ x, y = zip(*self.pathpatch.get_path().vertices)
+
+ self.line, = ax.plot(x,y,marker='o', markerfacecolor='r', animated=True)
+
+ self._ind = None # the active vert
+
+ canvas.mpl_connect('draw_event', self.draw_callback)
+ canvas.mpl_connect('button_press_event', self.button_press_callback)
+ canvas.mpl_connect('key_press_event', self.key_press_callback)
+ canvas.mpl_connect('button_release_event', self.button_release_callback)
+ canvas.mpl_connect('motion_notify_event', self.motion_notify_callback)
+ self.canvas = canvas
+
+
+ def draw_callback(self, event):
+ self.background = self.canvas.copy_from_bbox(self.ax.bbox)
+ self.ax.draw_artist(self.pathpatch)
+ self.ax.draw_artist(self.line)
+ self.canvas.blit(self.ax.bbox)
+
+ def pathpatch_changed(self, pathpatch):
+ 'this method is called whenever the pathpatchgon object is called'
+ # only copy the artist props to the line (except visibility)
+ vis = self.line.get_visible()
+ Artist.update_from(self.line, pathpatch)
+ self.line.set_visible(vis) # don't use the pathpatch visibility state
+
+
+ def get_ind_under_point(self, event):
+ 'get the index of the vertex under point if within epsilon tolerance'
+
+ # display coords
+ xy = np.asarray(self.pathpatch.get_path().vertices)
+ xyt = self.pathpatch.get_transform().transform(xy)
+ xt, yt = xyt[:, 0], xyt[:, 1]
+ d = np.sqrt((xt-event.x)**2 + (yt-event.y)**2)
+ ind = d.argmin()
+
+ if d[ind]>=self.epsilon:
+ ind = None
+
+ return ind
+
+ def button_press_callback(self, event):
+ 'whenever a mouse button is pressed'
+ if not self.showverts: return
+ if event.inaxes==None: return
+ if event.button != 1: return
+ self._ind = self.get_ind_under_point(event)
+
+ def button_release_callback(self, event):
+ 'whenever a mouse button is released'
+ if not self.showverts: return
+ if event.button != 1: return
+ self._ind = None
+
+ def key_press_callback(self, event):
+ 'whenever a key is pressed'
+ if not event.inaxes: return
+ if event.key=='t':
+ self.showverts = not self.showverts
+ self.line.set_visible(self.showverts)
+ if not self.showverts: self._ind = None
+
+ self.canvas.draw()
+
+ def motion_notify_callback(self, event):
+ 'on mouse movement'
+ if not self.showverts: return
+ if self._ind is None: return
+ if event.inaxes is None: return
+ if event.button != 1: return
+ x,y = event.xdata, event.ydata
+
+ # todo: expose me
+ vertices = self.pathpatch.get_path().vertices
+
+ vertices[self._ind] = x,y
+ self.line.set_data(zip(*vertices))
+
+ self.canvas.restore_region(self.background)
+ self.ax.draw_artist(self.pathpatch)
+ self.ax.draw_artist(self.line)
+ self.canvas.blit(self.ax.bbox)
+
+
+interactor = PathInteractor(patch)
+ax.set_title('drag vertices to update path')
+ax.set_xlim(-5,5)
+ax.set_ylim(-5,5)
+
+plt.show()
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 21:13:06
|
Revision: 5310
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5310&view=rev
Author: jdh2358
Date: 2008-05-29 14:12:59 -0700 (Thu, 29 May 2008)
Log Message:
-----------
added demo showing how to use curvy paths directly
Added Paths:
-----------
trunk/matplotlib/examples/api/path_patch_demo.py
Added: trunk/matplotlib/examples/api/path_patch_demo.py
===================================================================
--- trunk/matplotlib/examples/api/path_patch_demo.py (rev 0)
+++ trunk/matplotlib/examples/api/path_patch_demo.py 2008-05-29 21:12:59 UTC (rev 5310)
@@ -0,0 +1,34 @@
+import numpy as np
+import matplotlib.path as mpath
+import matplotlib.patches as mpatches
+import matplotlib.pyplot as plt
+
+Path = mpath.Path
+
+pathdata = [
+ (Path.MOVETO, (0, 0)),
+ (Path.CURVE4, (-1, 0)),
+ (Path.CURVE4, (-1, 1)),
+ (Path.CURVE4, (0, 1)),
+ (Path.LINETO, (2, 1)),
+ (Path.CURVE4, (3, 1)),
+ (Path.CURVE4, (3, 0)),
+ (Path.CURVE4, (2, 0)),
+ (Path.CLOSEPOLY, (0, 0)),
+ ]
+
+codes, verts = zip(*pathdata)
+path = mpath.Path(verts, codes)
+
+patch = mpatches.PathPatch(path, facecolor='green', edgecolor='yellow', alpha=0.5)
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.add_patch(patch)
+
+ax.set_xlim(-5,5)
+ax.set_ylim(-5,5)
+
+plt.show()
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 20:33:12
|
Revision: 5309
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5309&view=rev
Author: jdh2358
Date: 2008-05-29 13:33:07 -0700 (Thu, 29 May 2008)
Log Message:
-----------
fixed an image bug
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2008-05-29 20:29:54 UTC (rev 5308)
+++ trunk/matplotlib/lib/matplotlib/image.py 2008-05-29 20:33:07 UTC (rev 5309)
@@ -691,7 +691,7 @@
grayscale images, the return array is MxN. For RGB images, the
return value is MxNx3. For RGBA images the return value is MxNx4
"""
- def toarray(im)
+ def toarray(im):
'return a 1D array of floats'
x_str = im.tostring('raw',im.mode,0,-1)
x = np.fromstring(x_str,np.uint8)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 20:29:55
|
Revision: 5308
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5308&view=rev
Author: jdh2358
Date: 2008-05-29 13:29:54 -0700 (Thu, 29 May 2008)
Log Message:
-----------
Merged revisions 5304-5306 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r5304 | jdh2358 | 2008-05-29 13:25:15 -0500 (Thu, 29 May 2008) | 1 line
added clippath support for ps
........
r5305 | jdh2358 | 2008-05-29 13:25:58 -0500 (Thu, 29 May 2008) | 1 line
added clippath support for ps
........
r5306 | jdh2358 | 2008-05-29 15:17:32 -0500 (Thu, 29 May 2008) | 1 line
imread via pil now returns lumininance or rgb if possible
........
Modified Paths:
--------------
trunk/matplotlib/API_CHANGES
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab/image_demo3.py
trunk/matplotlib/lib/matplotlib/image.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5299
+ /branches/v0_91_maint:1-5307
Modified: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES 2008-05-29 20:18:41 UTC (rev 5307)
+++ trunk/matplotlib/API_CHANGES 2008-05-29 20:29:54 UTC (rev 5308)
@@ -1,4 +1,8 @@
+ matplotlib.image.imread now no longer always returns RGBA -- if
+ the image is luminance or RGB, it will return a MxN or MxNx3 array
+ if possible. Also uint8 is no longer always forced to float.
+
Rewrote the cm.ScalarMappable callback infrastructure to use
cbook.CallbackRegistry rather than custom callback handling. Amy
users of add_observer/notify of the cm.ScalarMappable should uae
@@ -197,6 +201,9 @@
END OF TRANSFORMS REFACTORING
+
+
+
0.91.2 Released
For csv2rec, checkrows=0 is the new default indicating all rows
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-29 20:18:41 UTC (rev 5307)
+++ trunk/matplotlib/CHANGELOG 2008-05-29 20:29:54 UTC (rev 5308)
@@ -1,3 +1,10 @@
+2008-05-29 matplotlib.image.imread now no longer always returns RGBA
+ -- if the image is luminance or RGB, it will return a MxN
+ or MxNx3 array if possible. Also uint8 is no longer always
+ forced to float.
+
+2008-05-29 Implement path clipping in PS backend - JDH
+
2008-05-29 Fixed two bugs in texmanager.py:
improved comparison of dvipng versions
fixed a bug introduced when get_grey method was added
Modified: trunk/matplotlib/examples/pylab/image_demo3.py
===================================================================
--- trunk/matplotlib/examples/pylab/image_demo3.py 2008-05-29 20:18:41 UTC (rev 5307)
+++ trunk/matplotlib/examples/pylab/image_demo3.py 2008-05-29 20:29:54 UTC (rev 5308)
@@ -3,14 +3,15 @@
try:
import Image
except ImportError, exc:
- raise SystemExit("PIL must be loaded to run this example")
+ raise SystemExit("PIL must be installed to run this example")
lena = Image.open('../data/lena.jpg')
dpi = rcParams['figure.dpi']
figsize = lena.size[0]/dpi, lena.size[1]/dpi
figure(figsize=figsize)
-
+ax = axes([0,0,1,1], frameon=False)
+ax.set_axis_off()
im = imshow(lena, origin='lower')
#savefig('image_demo3')
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2008-05-29 20:18:41 UTC (rev 5307)
+++ trunk/matplotlib/lib/matplotlib/image.py 2008-05-29 20:29:54 UTC (rev 5308)
@@ -650,11 +650,15 @@
"""
return image file in fname as numpy array
- Return value is a MxNx4 array of 0-1 normalized floats
+ return value is a numpy array. For grayscale images, the return
+ array is MxN. For RGB images, the return value is MxNx3. For
+ RGBA images the return value is MxNx4
matplotlib can only read PNGs natively, but if PIL is installed,
- it will use it to load the image and return an RGBA if possible
+ it will use it to load the image and return an array (if possible)
which can be used with imshow
+
+ TODO: support RGB and grayscale return values in _image.readpng
"""
def pilread():
@@ -682,15 +686,39 @@
def pil_to_array( pilImage ):
+ """
+ load a PIL image and return it as a numpy array of uint8. For
+ grayscale images, the return array is MxN. For RGB images, the
+ return value is MxNx3. For RGBA images the return value is MxNx4
+ """
+ def toarray(im)
+ 'return a 1D array of floats'
+ x_str = im.tostring('raw',im.mode,0,-1)
+ x = np.fromstring(x_str,np.uint8)
+ return x
+
if pilImage.mode in ('RGBA', 'RGBX'):
- im = pilImage # no need to convert images in rgba format
+ im = pilImage # no need to convert images
+ elif pilImage.mode=='L':
+ im = pilImage # no need to luminance images
+ # return MxN luminance array
+ x = toarray(im)
+ x.shape = im.size[1], im.size[0]
+ return x
+ elif pilImage.mode=='RGB':
+ #return MxNx3 RGB array
+ im = pilImage # no need to RGB images
+ x = toarray(im)
+ x.shape = im.size[1], im.size[0], 3
+ return x
+
else: # try to convert to an rgba image
try:
im = pilImage.convert('RGBA')
except ValueError:
raise RuntimeError('Unknown image mode')
- x_str = im.tostring('raw',im.mode,0,-1)
- x = np.fromstring(x_str,np.uint8)
+ # return MxNx4 RGBA array
+ x = toarray(im)
x.shape = im.size[1], im.size[0], 4
return x
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 20:18:42
|
Revision: 5307
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5307&view=rev
Author: jdh2358
Date: 2008-05-29 13:18:41 -0700 (Thu, 29 May 2008)
Log Message:
-----------
some prop changes on lena
Added Paths:
-----------
trunk/matplotlib/examples/data/lena.png
Added: trunk/matplotlib/examples/data/lena.png
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/examples/data/lena.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 20:17:41
|
Revision: 5306
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5306&view=rev
Author: jdh2358
Date: 2008-05-29 13:17:32 -0700 (Thu, 29 May 2008)
Log Message:
-----------
imread via pil now returns lumininance or rgb if possible
Modified Paths:
--------------
branches/v0_91_maint/API_CHANGES
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/image.py
Modified: branches/v0_91_maint/API_CHANGES
===================================================================
--- branches/v0_91_maint/API_CHANGES 2008-05-29 18:25:58 UTC (rev 5305)
+++ branches/v0_91_maint/API_CHANGES 2008-05-29 20:17:32 UTC (rev 5306)
@@ -1,3 +1,8 @@
+ matplotlib.image.imread now no longer always returns RGBA -- if
+ the image is luminance or RGB, it will return a MxN or MxNx3 array
+ if possible. Also uint8 is no longer always forced to float.
+
+
0.91.2 Released
For csv2rec, checkrows=0 is the new default indicating all rows
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-29 18:25:58 UTC (rev 5305)
+++ branches/v0_91_maint/CHANGELOG 2008-05-29 20:17:32 UTC (rev 5306)
@@ -1,3 +1,8 @@
+2008-05-29 matplotlib.image.imread now no longer always returns RGBA
+ -- if the image is luminance or RGB, it will return a MxN
+ or MxNx3 array if possible. Also uint8 is no longer always
+ forced to float.
+
2008-05-29 Implement path clipping in PS backend - JDH
2008-05-29 Fixed two bugs in texmanager.py:
Modified: branches/v0_91_maint/lib/matplotlib/image.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/image.py 2008-05-29 18:25:58 UTC (rev 5305)
+++ branches/v0_91_maint/lib/matplotlib/image.py 2008-05-29 20:17:32 UTC (rev 5306)
@@ -607,11 +607,15 @@
"""
return image file in fname as numpy array
- Return value is a MxNx4 array of 0-1 normalized floats
+ return value is a numpy array. For grayscale images, the return
+ array is MxN. For RGB images, the return value is MxNx3. For
+ RGBA images the return value is MxNx4
matplotlib can only read PNGs natively, but if PIL is installed,
- it will use it to load the image and return an RGBA if possible
+ it will use it to load the image and return an array (if possible)
which can be used with imshow
+
+ TODO: support RGB and grayscale return values in _image.readpng
"""
def pilread():
@@ -639,15 +643,39 @@
def pil_to_array( pilImage ):
+ """
+ load a PIL image and return it as a numpy array of uint8. For
+ grayscale images, the return array is MxN. For RGB images, the
+ return value is MxNx3. For RGBA images the return value is MxNx4
+ """
+ def toarray(im):
+ 'return a 1D array of floats'
+ x_str = im.tostring('raw',im.mode,0,-1)
+ x = npy.fromstring(x_str,npy.uint8)
+ return x
+
if pilImage.mode in ('RGBA', 'RGBX'):
- im = pilImage # no need to convert images in rgba format
+ im = pilImage # no need to convert images
+ elif pilImage.mode=='L':
+ im = pilImage # no need to luminance images
+ # return MxN luminance array
+ x = toarray(im)
+ x.shape = im.size[1], im.size[0]
+ return x
+ elif pilImage.mode=='RGB':
+ #return MxNx3 RGB array
+ im = pilImage # no need to RGB images
+ x = toarray(im)
+ x.shape = im.size[1], im.size[0], 3
+ return x
+
else: # try to convert to an rgba image
try:
im = pilImage.convert('RGBA')
except ValueError:
raise RuntimeError('Unknown image mode')
- x_str = im.tostring('raw',im.mode,0,-1)
- x = npy.fromstring(x_str,npy.uint8)
+ # return MxNx4 RGBA array
+ x = toarray(im)
x.shape = im.size[1], im.size[0], 4
return x
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 18:26:18
|
Revision: 5305
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5305&view=rev
Author: jdh2358
Date: 2008-05-29 11:25:58 -0700 (Thu, 29 May 2008)
Log Message:
-----------
added clippath support for ps
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-29 18:25:15 UTC (rev 5304)
+++ branches/v0_91_maint/CHANGELOG 2008-05-29 18:25:58 UTC (rev 5305)
@@ -1,3 +1,5 @@
+2008-05-29 Implement path clipping in PS backend - JDH
+
2008-05-29 Fixed two bugs in texmanager.py:
improved comparison of dvipng versions
fixed a bug introduced when get_grey method was added
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 18:25:45
|
Revision: 5304
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5304&view=rev
Author: jdh2358
Date: 2008-05-29 11:25:15 -0700 (Thu, 29 May 2008)
Log Message:
-----------
added clippath support for ps
Modified Paths:
--------------
branches/v0_91_maint/examples/polar_demo.py
branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py
branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py
Modified: branches/v0_91_maint/examples/polar_demo.py
===================================================================
--- branches/v0_91_maint/examples/polar_demo.py 2008-05-29 16:44:49 UTC (rev 5303)
+++ branches/v0_91_maint/examples/polar_demo.py 2008-05-29 18:25:15 UTC (rev 5304)
@@ -57,4 +57,6 @@
ax.set_rmax(2.0)
ax.set_title("And there was much rejoicing!", fontsize=20)
+
+fig.savefig('polar_demo')
show()
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py 2008-05-29 16:44:49 UTC (rev 5303)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py 2008-05-29 18:25:15 UTC (rev 5304)
@@ -150,6 +150,8 @@
self.used_characters = {}
self.mathtext_parser = MathTextParser("PS")
+ self._clip_paths = dict()
+
def track_characters(self, font, s):
"""Keeps track of which characters are required from
each font."""
@@ -445,6 +447,49 @@
ps = '%1.4g %1.4g m %1.4g %1.4g l'%(x0, y0, x1, y1)
self._draw_ps(ps, gc, None, "line")
+ def _get_clippath_command(self, clippath):
+ id = self._clip_paths.get(clippath)
+ if id is None:
+ id = 'c%x' % len(self._clip_paths)
+ ps_cmd = ['/%s {' % id]
+ ps_cmd.append(self._get_path(clippath))
+ ps_cmd.extend(['clip', 'newpath', '} bind def\n'])
+ self._pswriter.write('\n'.join(ps_cmd))
+ self._clip_paths[clippath] = id
+
+ return '%s\n'%id
+
+ def _get_path(self, path):
+ cmd = []
+ while 1:
+ code, xp, yp = path.vertex()
+
+
+ if code == agg.path_cmd_stop:
+ cmd.append('closepath\n')
+ break
+ elif code == agg.path_cmd_move_to:
+ cmd.append('%g %g m' % (xp, yp))
+ elif code == agg.path_cmd_line_to:
+ cmd.append('%g %g l' % (xp, yp))
+ elif code == agg.path_cmd_curve3:
+ verts = [xp, yp]
+ verts.extend(path.vertex()[1:])
+ cmd.append('%g %g %g %g %g %g c' % (verts[0], verts[1],
+ verts[0], verts[1],
+ verts[2], verts[3]))
+ elif code == agg.path_cmd_curve4:
+ verts = [xp, yp]
+ verts.extend(path.vertex()[1:])
+ verts.extend(path.vertex()[1:])
+ cmd.append('%g %g %g %g %g %g c'%tuple(verts))
+ elif code == agg.path_cmd_end_poly:
+ cmd.append('cl\n')
+
+ if len(cmd)==0:
+ return None
+ return '\n'.join(cmd)
+
def draw_markers(self, gc, path, rgbFace, x, y, transform):
"""
Draw the markers defined by path at each of the positions in x
@@ -515,10 +560,17 @@
mask = npy.where(npy.isnan(x) + npy.isnan(y), 0, 1)
cliprect = gc.get_clip_rectangle()
+ clippath = gc.get_clip_path()
if cliprect:
write('gsave\n')
xc,yc,wc,hc=cliprect
write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc))
+ if clippath:
+ write('gsave\n')
+ cmd = self._get_clippath_command(clippath)
+ write(cmd)
+
+
write(' '.join(['/o {', ps_cmd, '} bind def\n']))
# Now evaluate the marker command at each marker location:
while start < len(x):
@@ -527,8 +579,11 @@
write('\n'.join(ps)+'\n')
start = end
end += step
+
if cliprect: write('grestore\n')
+ if clippath: write('grestore\n')
+
def draw_path(self, gc, rgbFace, path):
ps_cmd = []
@@ -594,10 +649,17 @@
self.push_gc(gc, store=1)
cliprect = gc.get_clip_rectangle()
+ clippath = gc.get_clip_path()
+
if cliprect:
write('gsave\n')
xc,yc,wc,hc=cliprect
write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc))
+ if clippath:
+ write('gsave\n')
+ cmd = self._get_clippath_command(clippath)
+ write(cmd)
+
while start < len(points):
drawone.state = 'm'
ps = [i for i in [drawone(x,y,s) for x,y,s in points[start:end+1]]\
@@ -607,8 +669,8 @@
start = end
end += step
if cliprect: write('grestore\n')
+ if clippath: write('grestore\n')
-
def draw_lines_old(self, gc, x, y, transform=None):
"""
x and y are npy.equal length arrays, draw lines connecting each
@@ -633,11 +695,18 @@
self.push_gc(gc, store=1)
cliprect = gc.get_clip_rectangle()
+ clippath = gc.get_clip_path()
+
if cliprect:
write('gsave\n')
xc,yc,wc,hc=cliprect
write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc))
+ if clippath:
+ write('gsave\n')
+ cmd = self._get_clippath_command(clippath)
+ write(cmd)
+
steps = 50
start = 0
end = steps
@@ -672,7 +741,7 @@
end += steps
if transform:
if cliprect: write("grestore\n")
-
+ if clippath: write('grestore\n')
def draw_point(self, gc, x, y):
"""
Draw a single point at x,y
@@ -930,6 +999,7 @@
write("% "+command+"\n")
cliprect = gc.get_clip_rectangle()
+ clippath = gc.get_clip_path()
self.set_color(*gc.get_rgb())
self.set_linewidth(gc.get_linewidth())
jint = gc.get_joinstyle()
@@ -941,6 +1011,13 @@
if cliprect:
x,y,w,h=cliprect
write('gsave\n%1.4g %1.4g %1.4g %1.4g clipbox\n' % (w,h,x,y))
+
+ if clippath:
+ write('gsave\n')
+ cmd = self._get_clippath_command(clippath)
+ write(cmd)
+
+
# Jochen, is the strip necessary? - this could be a honking big string
write(ps.strip())
write("\n")
@@ -962,6 +1039,9 @@
if cliprect:
write("grestore\n")
+ if clippath:
+ write('grestore\n')
+
def push_gc(self, gc, store=1):
"""
Push the current onto stack, with the exception of the clip box, which
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 16:44:49 UTC (rev 5303)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 18:25:15 UTC (rev 5304)
@@ -71,7 +71,7 @@
cmd.append('L%g %g' % (xp, yp))
elif code == agg.path_cmd_curve3:
verts = [xp, yp]
- verts.extent(path.vertex()[1:])
+ verts.extend(path.vertex()[1:])
verts[-1] = self.height - verts[-1]
cmd.append('Q%g %g %g %g' % tuple(verts))
elif code == agg.path_cmd_curve4:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 16:44:55
|
Revision: 5303
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5303&view=rev
Author: jdh2358
Date: 2008-05-29 09:44:49 -0700 (Thu, 29 May 2008)
Log Message:
-----------
fixed the font rotation agg bug -- and there was much rejoicing
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/ticker.py
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-29 15:55:55 UTC (rev 5302)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-29 16:44:49 UTC (rev 5303)
@@ -301,6 +301,7 @@
self._scientific = True
self._powerlimits = rcParams['axes.formatter.limits']
+
def fix_minus(self, s):
'use a unicode minus rather than hyphen'
if rcParams['text.usetex']: return s
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-05-29 15:55:55 UTC (rev 5302)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-05-29 16:44:49 UTC (rev 5303)
@@ -679,8 +679,11 @@
typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
typedef agg::span_interpolator_linear<> interpolator_type;
typedef agg::image_accessor_clip<agg::pixfmt_gray8> image_accessor_type;
- typedef agg::span_image_filter_gray_2x2<image_accessor_type, interpolator_type>
+ //typedef agg::span_image_filter_gray_2x2<image_accessor_type, interpolator_type>
+ // image_span_gen_type;
+ typedef agg::span_image_filter_gray<image_accessor_type, interpolator_type>
image_span_gen_type;
+
typedef font_to_rgba<image_span_gen_type> span_gen_type;
typedef agg::renderer_scanline_aa<renderer_base, color_span_alloc_type, span_gen_type>
renderer_type;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-29 15:55:57
|
Revision: 5302
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5302&view=rev
Author: jdh2358
Date: 2008-05-29 08:55:55 -0700 (Thu, 29 May 2008)
Log Message:
-----------
turned off unicode minus for usetex
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-29 15:13:52 UTC (rev 5301)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-29 15:55:55 UTC (rev 5302)
@@ -179,7 +179,7 @@
"""
some classes may want to replace a hyphen for minus with the
proper unicode symbol as described here
-
+
http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720.
The default is to do nothing
@@ -191,7 +191,7 @@
should have an explicit format_data_short method
"""
return s
-
+
class NullFormatter(Formatter):
'Always return the empty string'
def __call__(self, x, pos=None):
@@ -303,7 +303,8 @@
def fix_minus(self, s):
'use a unicode minus rather than hyphen'
- return s.replace('-', u'\u2212')
+ if rcParams['text.usetex']: return s
+ else: return s.replace('-', u'\u2212')
def __call__(self, x, pos=None):
'Return the format for tick val x at position pos'
@@ -366,7 +367,7 @@
s = ''.join(('$',sciNotStr,offsetStr,'$'))
else:
s = ''.join((sciNotStr,offsetStr))
-
+
return self.fix_minus(s)
def set_locs(self, locs):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-29 15:14:24
|
Revision: 5301
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5301&view=rev
Author: mdboom
Date: 2008-05-29 08:13:52 -0700 (Thu, 29 May 2008)
Log Message:
-----------
Removed erroneous CHANGELOG entry (it was applied only to branch)
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-29 14:57:15 UTC (rev 5300)
+++ trunk/matplotlib/CHANGELOG 2008-05-29 15:13:52 UTC (rev 5301)
@@ -3,8 +3,6 @@
fixed a bug introduced when get_grey method was added
- DSD
-2008-05-29 Implement path clipping in SVG backend - MGD
-
2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte
characters are used with Type 3 fonts - MGD
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-29 14:58:07
|
Revision: 5300
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5300&view=rev
Author: mdboom
Date: 2008-05-29 07:57:15 -0700 (Thu, 29 May 2008)
Log Message:
-----------
Merged revisions 5295-5299 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint
........
r5298 | mdboom | 2008-05-29 09:01:40 -0400 (Thu, 29 May 2008) | 2 lines
Implement path clipping in SVG backend.
........
r5299 | dsdale | 2008-05-29 09:54:04 -0400 (Thu, 29 May 2008) | 3 lines
fixed two bugs in texmanager: dvipng version comparison, and
another related to the addition of the get_gray method
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/texmanager.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5294
+ /branches/v0_91_maint:1-5299
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-29 13:54:04 UTC (rev 5299)
+++ trunk/matplotlib/CHANGELOG 2008-05-29 14:57:15 UTC (rev 5300)
@@ -1,3 +1,10 @@
+2008-05-29 Fixed two bugs in texmanager.py:
+ improved comparison of dvipng versions
+ fixed a bug introduced when get_grey method was added
+ - DSD
+
+2008-05-29 Implement path clipping in SVG backend - MGD
+
2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte
characters are used with Type 3 fonts - MGD
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py 2008-05-29 13:54:04 UTC (rev 5299)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py 2008-05-29 14:57:15 UTC (rev 5300)
@@ -33,7 +33,8 @@
"""
-import copy, glob, md5, os, shutil, sys
+import copy, glob, md5, os, shutil, sys, warnings
+import distutils.version
import numpy as np
import matplotlib as mpl
from matplotlib import rcParams
@@ -44,14 +45,15 @@
if sys.platform.startswith('win'): cmd_split = '&'
else: cmd_split = ';'
-def get_dvipng_version():
+def dvipng_hack_alpha():
stdin, stdout = os.popen4('dvipng -version')
for line in stdout:
if line.startswith('dvipng '):
version = line.split()[-1]
mpl.verbose.report('Found dvipng version %s'% version,
'helpful')
- return version
+ version = distutils.version.LooseVersion(version)
+ return version < distutils.version.LooseVersion('1.6')
raise RuntimeError('Could not obtain dvipng version')
@@ -78,7 +80,7 @@
if not os.path.exists(texcache):
os.mkdir(texcache)
- dvipngVersion = get_dvipng_version()
+ _dvipng_hack_alpha = dvipng_hack_alpha()
# mappable cache of
rgba_arrayd = {}
@@ -364,8 +366,28 @@
pngfile = self.make_png(tex, fontsize, dpi)
X = readpng(os.path.join(self.texcache, pngfile))
- if (self.dvipngVersion < '1.6') or rcParams['text.dvipnghack']:
- # hack the alpha channel as described in comment above
+ if self._dvipng_hack_alpha or rcParams['text.dvipnghack']:
+ # hack the alpha channel
+ # dvipng assumed a constant background, whereas we want to
+ # overlay these rasters with antialiasing over arbitrary
+ # backgrounds that may have other figure elements under them.
+ # When you set dvipng -bg Transparent, it actually makes the
+ # alpha channel 1 and does the background compositing and
+ # antialiasing itself and puts the blended data in the rgb
+ # channels. So what we do is extract the alpha information
+ # from the red channel, which is a blend of the default dvipng
+ # background (white) and foreground (black). So the amount of
+ # red (or green or blue for that matter since white and black
+ # blend to a grayscale) is the alpha intensity. Once we
+ # extract the correct alpha information, we assign it to the
+ # alpha channel properly and let the users pick their rgb. In
+ # this way, we can overlay tex strings on arbitrary
+ # backgrounds with antialiasing
+ #
+ # red = alpha*red_foreground + (1-alpha)*red_background
+ #
+ # Since the foreground is black (0) and the background is
+ # white (1) this reduces to red = 1-alpha or alpha = 1-red
alpha = np.sqrt(1-X[:,:,0])
else:
alpha = X[:,:,-1]
@@ -378,26 +400,6 @@
"""
Returns latex's rendering of the tex string as an rgba array
"""
- # dvipng assumes a constant background, whereas we want to
- # overlay these rasters with antialiasing over arbitrary
- # backgrounds that may have other figure elements under them.
- # When you set dvipng -bg Transparent, it actually makes the
- # alpha channel 1 and does the background compositing and
- # antialiasing itself and puts the blended data in the rgb
- # channels. So what we do is extract the alpha information
- # from the red channel, which is a blend of the default dvipng
- # background (white) and foreground (black). So the amount of
- # red (or green or blue for that matter since white and black
- # blend to a grayscale) is the alpha intensity. Once we
- # extract the correct alpha information, we assign it to the
- # alpha channel properly and let the users pick their rgb. In
- # this way, we can overlay tex strings on arbitrary
- # backgrounds with antialiasing
- #
- # red = alpha*red_foreground + (1-alpha)*red_background
- #
- # Since the foreground is black (0) and the background is
- # white (1) this reduces to red = 1-alpha or alpha = 1-red
if not fontsize: fontsize = rcParams['font.size']
if not dpi: dpi = rcParams['savefig.dpi']
r,g,b = rgb
@@ -407,7 +409,8 @@
if Z is None:
alpha = self.get_grey(tex, fontsize, dpi)
- Z = np.zeros((X.shape[0], X.shape[1], 4), np.float)
+ Z = np.zeros((alpha.shape[0], alpha.shape[1], 4), np.float)
+
Z[:,:,0] = r
Z[:,:,1] = g
Z[:,:,2] = b
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-05-29 13:54:10
|
Revision: 5299
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5299&view=rev
Author: dsdale
Date: 2008-05-29 06:54:04 -0700 (Thu, 29 May 2008)
Log Message:
-----------
fixed two bugs in texmanager: dvipng version comparison, and
another related to the addition of the get_gray method
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/texmanager.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-29 13:01:40 UTC (rev 5298)
+++ branches/v0_91_maint/CHANGELOG 2008-05-29 13:54:04 UTC (rev 5299)
@@ -1,3 +1,8 @@
+2008-05-29 Fixed two bugs in texmanager.py:
+ improved comparison of dvipng versions
+ fixed a bug introduced when get_grey method was added
+ - DSD
+
2008-05-29 Implement path clipping in SVG backend - MGD
2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte
Modified: branches/v0_91_maint/lib/matplotlib/texmanager.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/texmanager.py 2008-05-29 13:01:40 UTC (rev 5298)
+++ branches/v0_91_maint/lib/matplotlib/texmanager.py 2008-05-29 13:54:04 UTC (rev 5299)
@@ -34,6 +34,7 @@
"""
import copy, glob, md5, os, shutil, sys, warnings
+import distutils.version
import numpy as npy
import matplotlib as mpl
from matplotlib import rcParams
@@ -44,14 +45,15 @@
if sys.platform.startswith('win'): cmd_split = '&'
else: cmd_split = ';'
-def get_dvipng_version():
+def dvipng_hack_alpha():
stdin, stdout = os.popen4('dvipng -version')
for line in stdout:
if line.startswith('dvipng '):
version = line.split()[-1]
mpl.verbose.report('Found dvipng version %s'% version,
'helpful')
- return version
+ version = distutils.version.LooseVersion(version)
+ return version < distutils.version.LooseVersion('1.6')
raise RuntimeError('Could not obtain dvipng version')
@@ -76,7 +78,7 @@
if not os.path.exists(texcache):
os.mkdir(texcache)
- dvipngVersion = get_dvipng_version()
+ _dvipng_hack_alpha = dvipng_hack_alpha()
# mappable cache of
rgba_arrayd = {}
@@ -332,8 +334,28 @@
pngfile = self.make_png(tex, fontsize, dpi)
X = readpng(os.path.join(self.texcache, pngfile))
- if (self.dvipngVersion < '1.6') or rcParams['text.dvipnghack']:
- # hack the alpha channel as described in comment above
+ if self._dvipng_hack_alpha or rcParams['text.dvipnghack']:
+ # hack the alpha channel
+ # dvipng assumed a constant background, whereas we want to
+ # overlay these rasters with antialiasing over arbitrary
+ # backgrounds that may have other figure elements under them.
+ # When you set dvipng -bg Transparent, it actually makes the
+ # alpha channel 1 and does the background compositing and
+ # antialiasing itself and puts the blended data in the rgb
+ # channels. So what we do is extract the alpha information
+ # from the red channel, which is a blend of the default dvipng
+ # background (white) and foreground (black). So the amount of
+ # red (or green or blue for that matter since white and black
+ # blend to a grayscale) is the alpha intensity. Once we
+ # extract the correct alpha information, we assign it to the
+ # alpha channel properly and let the users pick their rgb. In
+ # this way, we can overlay tex strings on arbitrary
+ # backgrounds with antialiasing
+ #
+ # red = alpha*red_foreground + (1-alpha)*red_background
+ #
+ # Since the foreground is black (0) and the background is
+ # white (1) this reduces to red = 1-alpha or alpha = 1-red
alpha = npy.sqrt(1-X[:,:,0])
else:
alpha = X[:,:,-1]
@@ -346,26 +368,6 @@
"""
Return tex string as an rgba array
"""
- # dvipng assumes a constant background, whereas we want to
- # overlay these rasters with antialiasing over arbitrary
- # backgrounds that may have other figure elements under them.
- # When you set dvipng -bg Transparent, it actually makes the
- # alpha channel 1 and does the background compositing and
- # antialiasing itself and puts the blended data in the rgb
- # channels. So what we do is extract the alpha information
- # from the red channel, which is a blend of the default dvipng
- # background (white) and foreground (black). So the amount of
- # red (or green or blue for that matter since white and black
- # blend to a grayscale) is the alpha intensity. Once we
- # extract the correct alpha information, we assign it to the
- # alpha channel properly and let the users pick their rgb. In
- # this way, we can overlay tex strings on arbitrary
- # backgrounds with antialiasing
- #
- # red = alpha*red_foreground + (1-alpha)*red_background
- #
- # Since the foreground is black (0) and the background is
- # white (1) this reduces to red = 1-alpha or alpha = 1-red
if not fontsize: fontsize = rcParams['font.size']
if not dpi: dpi = rcParams['savefig.dpi']
r,g,b = rgb
@@ -375,7 +377,7 @@
if Z is None:
alpha = self.get_grey(tex, fontsize, dpi)
- Z = npy.zeros((X.shape[0], X.shape[1], 4), npy.float)
+ Z = npy.zeros((alpha.shape[0], alpha.shape[1], 4), npy.float)
Z[:,:,0] = r
Z[:,:,1] = g
Z[:,:,2] = b
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-29 13:01:45
|
Revision: 5298
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5298&view=rev
Author: mdboom
Date: 2008-05-29 06:01:40 -0700 (Thu, 29 May 2008)
Log Message:
-----------
Implement path clipping in SVG backend.
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-29 11:47:44 UTC (rev 5297)
+++ branches/v0_91_maint/CHANGELOG 2008-05-29 13:01:40 UTC (rev 5298)
@@ -1,3 +1,5 @@
+2008-05-29 Implement path clipping in SVG backend - MGD
+
2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte
characters are used with Type 3 fonts - MGD
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 11:47:44 UTC (rev 5297)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 13:01:40 UTC (rev 5298)
@@ -56,6 +56,37 @@
self._svgwriter.write ('%s<%s style="%s" %s %s/>\n' % (
cliprect, element, style, clippath, details))
+ def _path_commands(self, path):
+ cmd = []
+ while 1:
+ code, xp, yp = path.vertex()
+ yp = self.height - yp
+
+ if code == agg.path_cmd_stop:
+ cmd.append('z') # Hack, path_cmd_end_poly not found
+ break
+ elif code == agg.path_cmd_move_to:
+ cmd.append('M%g %g' % (xp, yp))
+ elif code == agg.path_cmd_line_to:
+ cmd.append('L%g %g' % (xp, yp))
+ elif code == agg.path_cmd_curve3:
+ verts = [xp, yp]
+ verts.extent(path.vertex()[1:])
+ verts[-1] = self.height - verts[-1]
+ cmd.append('Q%g %g %g %g' % tuple(verts))
+ elif code == agg.path_cmd_curve4:
+ verts = [xp, yp]
+ verts.extend(path.vertex()[1:])
+ verts[-1] = self.height - verts[-1]
+ verts.extend(path.vertex()[1:])
+ verts[-1] = self.height - verts[-1]
+ cmd.append('C%g %g %g %g %g %g'%tuple(verts))
+ elif code == agg.path_cmd_end_poly:
+ cmd.append('z')
+
+ path_data = "".join(cmd)
+ return path_data
+
def _get_font(self, prop):
key = hash(prop)
font = self.fontd.get(key)
@@ -108,10 +139,28 @@
def _get_gc_clip_svg(self, gc):
cliprect = gc.get_clip_rectangle()
- if cliprect is None:
+ clippath = gc.get_clip_path()
+ if cliprect is None and clippath is None:
return '', None
- else:
+ elif clippath is not None:
# See if we've already seen this clip rectangle
+ key = hash(clippath)
+ if self._clipd.get(key) is None: # If not, store a new clipPath
+ self._clipd[key] = clippath
+ style = "stroke: gray; fill: none;"
+ path_data = self._path_commands(clippath)
+ path = """\
+<defs>
+ <clipPath id="%(key)s">
+ <path d="%(path_data)s"/>
+ </clipPath>
+</defs>
+""" % locals()
+ return path, key
+ else:
+ return '', key
+ elif cliprect is not None:
+ # See if we've already seen this clip rectangle
key = hash(cliprect)
if self._clipd.get(key) is None: # If not, store a new clipPath
self._clipd[key] = cliprect
@@ -139,35 +188,7 @@
self._svgwriter.write('</g>\n')
def draw_path(self, gc, rgbFace, path):
- cmd = []
-
- while 1:
- code, xp, yp = path.vertex()
- yp = self.height - yp
-
- if code == agg.path_cmd_stop:
- cmd.append('z') # Hack, path_cmd_end_poly not found
- break
- elif code == agg.path_cmd_move_to:
- cmd.append('M%g %g' % (xp, yp))
- elif code == agg.path_cmd_line_to:
- cmd.append('L%g %g' % (xp, yp))
- elif code == agg.path_cmd_curve3:
- verts = [xp, yp]
- verts.extent(path.vertex()[1:])
- verts[-1] = self.height - verts[-1]
- cmd.append('Q%g %g %g %g' % tuple(verts))
- elif code == agg.path_cmd_curve4:
- verts = [xp, yp]
- verts.extend(path.vertex()[1:])
- verts[-1] = self.height - verts[-1]
- verts.extend(path.vertex()[1:])
- verts[-1] = self.height - verts[-1]
- cmd.append('C%g %g %g %g %g %g'%tuple(verts))
- elif code == agg.path_cmd_end_poly:
- cmd.append('z')
-
- path_data = "".join(cmd)
+ path_data = self._path_commands(path)
self._draw_svg_element("path", 'd="%s"' % path_data, gc, rgbFace)
def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-29 11:47:47
|
Revision: 5297
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5297&view=rev
Author: jswhit
Date: 2008-05-29 04:47:44 -0700 (Thu, 29 May 2008)
Log Message:
-----------
added Changelog entry for pyproj update, fixed typo in README.
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/README
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2008-05-28 18:39:05 UTC (rev 5296)
+++ trunk/toolkits/basemap/Changelog 2008-05-29 11:47:44 UTC (rev 5297)
@@ -1,4 +1,5 @@
version 0.99
+ * updated pyproj to 1.8.5.
* fixed bug in NetCDFFile creating masked arrays when both
_FillValue and missing_value exist.
* drawparallels and drawmeridians return a dictionary containing
Modified: trunk/toolkits/basemap/README
===================================================================
--- trunk/toolkits/basemap/README 2008-05-28 18:39:05 UTC (rev 5296)
+++ trunk/toolkits/basemap/README 2008-05-29 11:47:44 UTC (rev 5297)
@@ -100,7 +100,7 @@
the client is included) and httplib2. By default, setup.py checks to
see if these are already installed, and if so does not try to overwrite
them. If you get import errors related to either of these two packages,
-edit setup.cfg and set pydap and/or httplib to True to force
+edit setup.cfg and set pydap and/or httplib2 to True to force
installation of the included versions.
4) To test, cd to the examples directory and run 'python simpletest.py'.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-28 18:39:11
|
Revision: 5296
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5296&view=rev
Author: jdh2358
Date: 2008-05-28 11:39:05 -0700 (Wed, 28 May 2008)
Log Message:
-----------
readded minus/hyphen patch now that Michael has fixed PDF unicode
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-28 18:22:39 UTC (rev 5295)
+++ trunk/matplotlib/CHANGELOG 2008-05-28 18:39:05 UTC (rev 5296)
@@ -6,8 +6,7 @@
http://sourceforge.net/tracker/index.php?func=detail&aid=1866207&group_id=80706&atid=560722
- JDH
-2008-05-28 REVERTING due to PDF problem. Replaced '-' with u'\u2212'
- for minus sign as requested in
+2008-05-28 Replaced '-' with u'\u2212' for minus sign as requested in
http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720
2008-05-28 zero width/height Rectangles no longer influence the
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 18:22:39 UTC (rev 5295)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 18:39:05 UTC (rev 5296)
@@ -175,6 +175,23 @@
def set_locs(self, locs):
self.locs = locs
+ def fix_minus(self, s):
+ """
+ some classes may want to replace a hyphen for minus with the
+ proper unicode symbol as described here
+
+ http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720.
+ The default is to do nothing
+
+ Note, if you use this method, eg in format_data or call, you
+ probably don't want to use it for format_data_short since the
+ toolbar uses this for interative coord reporting and I doubt
+ we can expect GUIs across platforms will handle the unicode
+ correctly. So for now the classes that override fix_minus
+ should have an explicit format_data_short method
+ """
+ return s
+
class NullFormatter(Formatter):
'Always return the empty string'
def __call__(self, x, pos=None):
@@ -270,6 +287,7 @@
such that the tick labels are meaningful. Scientific notation is used for
data < 1e-3 or data >= 1e4.
"""
+
def __init__(self, useOffset=True, useMathText=False):
# useOffset allows plotting small data ranges with large offsets:
# for example: [1+1e-9,1+2e-9,1+3e-9]
@@ -283,12 +301,17 @@
self._scientific = True
self._powerlimits = rcParams['axes.formatter.limits']
+ def fix_minus(self, s):
+ 'use a unicode minus rather than hyphen'
+ return s.replace('-', u'\u2212')
+
def __call__(self, x, pos=None):
'Return the format for tick val x at position pos'
if len(self.locs)==0:
return ''
else:
- return self.pprint_val(x)
+ s = self.pprint_val(x)
+ return self.fix_minus(s)
def set_scientific(self, b):
'''True or False to turn scientific notation on or off
@@ -314,11 +337,14 @@
def format_data(self,value):
'return a formatted string representation of a number'
- return self._formatSciNotation('%1.10e'% value)
+ s = self._formatSciNotation('%1.10e'% value)
+ return self.fix_minus(s)
+
def get_offset(self):
"""Return scientific notation, plus offset"""
if len(self.locs)==0: return ''
+ s = ''
if self.orderOfMagnitude or self.offset:
offsetStr = ''
sciNotStr = ''
@@ -333,14 +359,15 @@
if self._useMathText:
if sciNotStr != '':
sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
- return ''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
+ s = ''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
elif self._usetex:
if sciNotStr != '':
sciNotStr = r'\times%s' % sciNotStr
- return ''.join(('$',sciNotStr,offsetStr,'$'))
+ s = ''.join(('$',sciNotStr,offsetStr,'$'))
else:
- return ''.join((sciNotStr,offsetStr))
- else: return ''
+ s = ''.join((sciNotStr,offsetStr))
+
+ return self.fix_minus(s)
def set_locs(self, locs):
'set the locations of the ticks'
@@ -408,7 +435,6 @@
def pprint_val(self, x):
xp = (x-self.offset)/10**self.orderOfMagnitude
if np.absolute(xp) < 1e-8: xp = 0
- #return (self.format % xp).replace('-', u'\u2212') # crashes PDF
return self.format % xp
def _formatSciNotation(self, s):
@@ -429,8 +455,8 @@
else:
return r'%s%s'%(significand, exponent)
else:
- #sign = sign.replace('-', u'\u2212') # crashes PDF
- return ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
+ s = ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
+ return s
except IndexError, msg:
return s
@@ -476,15 +502,20 @@
elif x<1: s = '%1.0e'%x
else : s = self.pprint_val(x,d)
if sign == -1:
- return '-%s' % s
- return s
+ s = '-%s' % s
+ return self.fix_minus(s)
+
def format_data(self,value):
self.labelOnlyBase = False
value = cbook.strip_math(self.__call__(value))
self.labelOnlyBase = True
return value
+ def format_data_short(self,value):
+ 'return a short formatted string representation of a number'
+ return '%1.3g'%value
+
def is_decade(self, x):
n = self.nearest_long(x)
return abs(x-n)<1e-10
@@ -541,10 +572,11 @@
elif fx<1: s = '%1.0e'%fx
else : s = self.pprint_val(fx,d)
if sign == -1:
- return '-%s' % s
- return s
+ s = '-%s' % s
+ return self.fix_minus(s)
+
class LogFormatterMathtext(LogFormatter):
"""
Format values for log axis; using exponent = log_base(value)
@@ -582,8 +614,6 @@
return s
-
-
class Locator(TickHelper):
"""
Determine the tick locations;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-28 18:22:43
|
Revision: 5295
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5295&view=rev
Author: mdboom
Date: 2008-05-28 11:22:39 -0700 (Wed, 28 May 2008)
Log Message:
-----------
Merged revisions 5284-5294 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_91_maint
........
r5292 | jdh2358 | 2008-05-28 14:03:15 -0400 (Wed, 28 May 2008) | 1 line
added keywords to configure sliders for sf patch 1866207
........
r5293 | mdboom | 2008-05-28 14:13:05 -0400 (Wed, 28 May 2008) | 3 lines
Fix PDFs that crash xpdf and ghostscript when two-byte codepoints are
used with Type 3 fonts.
........
r5294 | mdboom | 2008-05-28 14:19:30 -0400 (Wed, 28 May 2008) | 2 lines
Adding CHANGELOG entry and scary comment about what was going wrong.
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/widgets/sliders.py
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
trunk/matplotlib/lib/matplotlib/widgets.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5283
+ /branches/v0_91_maint:1-5294
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-28 18:19:30 UTC (rev 5294)
+++ trunk/matplotlib/CHANGELOG 2008-05-28 18:22:39 UTC (rev 5295)
@@ -1,3 +1,11 @@
+2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte
+ characters are used with Type 3 fonts - MGD
+
+2008-05-28 Allow keyword args to configure widget properties as
+ requested in
+ http://sourceforge.net/tracker/index.php?func=detail&aid=1866207&group_id=80706&atid=560722
+ - JDH
+
2008-05-28 REVERTING due to PDF problem. Replaced '-' with u'\u2212'
for minus sign as requested in
http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720
Modified: trunk/matplotlib/examples/widgets/sliders.py
===================================================================
--- trunk/matplotlib/examples/widgets/sliders.py 2008-05-28 18:19:30 UTC (rev 5294)
+++ trunk/matplotlib/examples/widgets/sliders.py 2008-05-28 18:22:39 UTC (rev 5295)
@@ -12,8 +12,8 @@
axfreq = axes([0.125, 0.1, 0.775, 0.03], axisbg=axcolor)
axamp = axes([0.125, 0.15, 0.775, 0.03], axisbg=axcolor)
-sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=1)
-samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=1)
+sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=1, facecolor='blue', alpha=0.5)
+samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=1, facecolor='red', alpha=0.5)
def update(val):
amp = samp.val
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:19:30 UTC (rev 5294)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:22:39 UTC (rev 5295)
@@ -719,6 +719,13 @@
charprocDict['Type'] = Name('XObject')
charprocDict['Subtype'] = Name('Form')
charprocDict['BBox'] = bbox
+ # Each glyph includes bounding box information,
+ # but xpdf and ghostscript can't handle it in a
+ # Form XObject (they segfault!!!), so we remove it
+ # from the stream here. It's not needed anyway,
+ # since the Form XObject includes it in its BBox
+ # value.
+ stream = stream[stream.find("d1") + 2:]
charprocObject = self.reserveObject('charProc')
self.beginStream(charprocObject.id, None, charprocDict)
self.currentstream.write(stream)
Modified: trunk/matplotlib/lib/matplotlib/widgets.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/widgets.py 2008-05-28 18:19:30 UTC (rev 5294)
+++ trunk/matplotlib/lib/matplotlib/widgets.py 2008-05-28 18:22:39 UTC (rev 5295)
@@ -171,7 +171,7 @@
"""
def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
closedmin=True, closedmax=True, slidermin=None, slidermax=None,
- dragging=True):
+ dragging=True, **kwargs):
"""
Create a slider from valmin to valmax in axes ax;
@@ -185,6 +185,11 @@
slidermin and slidermax - be used to contrain the value of
this slider to the values of other sliders.
+
+ additional kwargs are passed on to self.poly which is the
+ matplotlib.patches.Rectangle which draws the slider. See the
+ matplotlib.patches.Rectangle documentation for legal property
+ names (eg facecolor, edgecolor, alpha, ...)
"""
self.ax = ax
@@ -192,7 +197,7 @@
self.valmax = valmax
self.val = valinit
self.valinit = valinit
- self.poly = ax.axvspan(valmin,valinit,0,1)
+ self.poly = ax.axvspan(valmin,valinit,0,1, **kwargs)
self.vline = ax.axvline(valinit,0,1, color='r', lw=1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-28 18:19:32
|
Revision: 5294
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5294&view=rev
Author: mdboom
Date: 2008-05-28 11:19:30 -0700 (Wed, 28 May 2008)
Log Message:
-----------
Adding CHANGELOG entry and scary comment about what was going wrong.
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-28 18:13:05 UTC (rev 5293)
+++ branches/v0_91_maint/CHANGELOG 2008-05-28 18:19:30 UTC (rev 5294)
@@ -1,3 +1,6 @@
+2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte
+ characters are used with Type 3 fonts - MGD
+
2008-05-28 Allow keyword args to configure widget properties as
requested in
http://sourceforge.net/tracker/index.php?func=detail&aid=1866207&group_id=80706&atid=560722
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:13:05 UTC (rev 5293)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:19:30 UTC (rev 5294)
@@ -713,6 +713,12 @@
charprocDict['Type'] = Name('XObject')
charprocDict['Subtype'] = Name('Form')
charprocDict['BBox'] = bbox
+ # Each glyph includes bounding box information,
+ # but xpdf and ghostscript can't handle it in a
+ # Form XObject (they segfault!!!), so we remove it
+ # from the stream here. It's not needed anyway,
+ # since the Form XObject includes it in its BBox
+ # value.
stream = stream[stream.find("d1") + 2:]
charprocObject = self.reserveObject('charProc')
self.beginStream(charprocObject.id, None, charprocDict)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-05-28 18:13:30
|
Revision: 5293
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5293&view=rev
Author: mdboom
Date: 2008-05-28 11:13:05 -0700 (Wed, 28 May 2008)
Log Message:
-----------
Fix PDFs that crash xpdf and ghostscript when two-byte codepoints are
used with Type 3 fonts.
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:03:15 UTC (rev 5292)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:13:05 UTC (rev 5293)
@@ -713,6 +713,7 @@
charprocDict['Type'] = Name('XObject')
charprocDict['Subtype'] = Name('Form')
charprocDict['BBox'] = bbox
+ stream = stream[stream.find("d1") + 2:]
charprocObject = self.reserveObject('charProc')
self.beginStream(charprocObject.id, None, charprocDict)
self.currentstream.write(stream)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-28 18:03:26
|
Revision: 5292
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5292&view=rev
Author: jdh2358
Date: 2008-05-28 11:03:15 -0700 (Wed, 28 May 2008)
Log Message:
-----------
added keywords to configure sliders for sf patch 1866207
Modified Paths:
--------------
branches/v0_91_maint/CHANGELOG
branches/v0_91_maint/examples/logo.py
branches/v0_91_maint/examples/widgets/sliders.py
branches/v0_91_maint/lib/matplotlib/widgets.py
Modified: branches/v0_91_maint/CHANGELOG
===================================================================
--- branches/v0_91_maint/CHANGELOG 2008-05-28 17:00:15 UTC (rev 5291)
+++ branches/v0_91_maint/CHANGELOG 2008-05-28 18:03:15 UTC (rev 5292)
@@ -1,3 +1,8 @@
+2008-05-28 Allow keyword args to configure widget properties as
+ requested in
+ http://sourceforge.net/tracker/index.php?func=detail&aid=1866207&group_id=80706&atid=560722
+ - JDH
+
2008-05-28 Fix rendering of composite glyphs in Type 3 conversion
(particularly as evidenced in the Eunjin.ttf Korean font)
Thanks Jae-Joon Lee for finding this!
Modified: branches/v0_91_maint/examples/logo.py
===================================================================
--- branches/v0_91_maint/examples/logo.py 2008-05-28 17:00:15 UTC (rev 5291)
+++ branches/v0_91_maint/examples/logo.py 2008-05-28 18:03:15 UTC (rev 5292)
@@ -8,7 +8,7 @@
file('data/membrane.dat', 'rb').read(), float32)
# 0.0005 is the sample interval
t = 0.0005*arange(len(x))
-figure(1, figsize=(7,1), dpi=100)
+figure(1, figsize=(4,1), dpi=70)
ax = subplot(111, axisbg='y')
plot(t, x)
text(0.5, 0.5,'matplotlib', color='r',
@@ -20,5 +20,5 @@
axis([1, 1.72,-60, 10])
setp(gca(), 'xticklabels', [])
setp(gca(), 'yticklabels', [])
-#savefig('logo2.png', dpi=300)
+savefig('logo2.png', dpi=70)
show()
Modified: branches/v0_91_maint/examples/widgets/sliders.py
===================================================================
--- branches/v0_91_maint/examples/widgets/sliders.py 2008-05-28 17:00:15 UTC (rev 5291)
+++ branches/v0_91_maint/examples/widgets/sliders.py 2008-05-28 18:03:15 UTC (rev 5292)
@@ -12,8 +12,8 @@
axfreq = axes([0.125, 0.1, 0.775, 0.03], axisbg=axcolor)
axamp = axes([0.125, 0.15, 0.775, 0.03], axisbg=axcolor)
-sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=1)
-samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=1)
+sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=1, facecolor='blue', alpha=0.5)
+samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=1, facecolor='red', alpha=0.5)
def update(val):
amp = samp.val
Modified: branches/v0_91_maint/lib/matplotlib/widgets.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/widgets.py 2008-05-28 17:00:15 UTC (rev 5291)
+++ branches/v0_91_maint/lib/matplotlib/widgets.py 2008-05-28 18:03:15 UTC (rev 5292)
@@ -171,7 +171,7 @@
"""
def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
closedmin=True, closedmax=True, slidermin=None, slidermax=None,
- dragging=True):
+ dragging=True, **kwargs):
"""
Create a slider from valmin to valmax in axes ax;
@@ -185,6 +185,11 @@
slidermin and slidermax - be used to contrain the value of
this slider to the values of other sliders.
+
+ additional kwargs are passed on to self.poly which is the
+ matplotlib.patches.Rectangle which draws the slider. See the
+ matplotlib.patches.Rectangle documentation for legal property
+ names (eg facecolor, edgecolor, alpha, ...)
"""
self.ax = ax
@@ -192,7 +197,7 @@
self.valmax = valmax
self.val = valinit
self.valinit = valinit
- self.poly = ax.axvspan(valmin,valinit,0,1)
+ self.poly = ax.axvspan(valmin,valinit,0,1, **kwargs)
self.vline = ax.axvline(valinit,0,1, color='r', lw=1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-28 17:00:44
|
Revision: 5291
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5291&view=rev
Author: jdh2358
Date: 2008-05-28 10:00:15 -0700 (Wed, 28 May 2008)
Log Message:
-----------
fixed patch rect area zero bug -- finally!
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-05-28 16:51:39 UTC (rev 5290)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-05-28 17:00:15 UTC (rev 5291)
@@ -1234,7 +1234,7 @@
# the bins, counts and patches lined up, but it throws off log
# scaling. We'll ignore rects with zero height or width in
# the auto-scaling
- if isinstance(p, mpatches.Rectangle) and p.get_width()==0. and p.get_height()==0.:
+ if isinstance(p, mpatches.Rectangle) and (p.get_width()==0. or p.get_height()==0.):
return
vertices = p.get_patch_transform().transform(p.get_path().vertices)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-28 16:51:41
|
Revision: 5290
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5290&view=rev
Author: jdh2358
Date: 2008-05-28 09:51:39 -0700 (Wed, 28 May 2008)
Log Message:
-----------
reverting due to PDF problem
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 16:46:53 UTC (rev 5289)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 16:51:39 UTC (rev 5290)
@@ -423,7 +423,7 @@
# reformat 1x10^y as 10^y
significand = ''
if exponent:
- exponent = u'10^{%s%s}'%(sign, exponent)
+ exponent = '10^{%s%s}'%(sign, exponent)
if significand and exponent:
return r'%s{\times}%s'%(significand, exponent)
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-28 16:46:57
|
Revision: 5289
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5289&view=rev
Author: jdh2358
Date: 2008-05-28 09:46:53 -0700 (Wed, 28 May 2008)
Log Message:
-----------
reverting due to PDF problem
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 16:44:32 UTC (rev 5288)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 16:46:53 UTC (rev 5289)
@@ -429,7 +429,7 @@
else:
return r'%s%s'%(significand, exponent)
else:
- sign = sign.replace('-', u'\u2212') # crashes PDF
+ #sign = sign.replace('-', u'\u2212') # crashes PDF
return ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
except IndexError, msg:
return s
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-28 16:44:47
|
Revision: 5288
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5288&view=rev
Author: jdh2358
Date: 2008-05-28 09:44:32 -0700 (Wed, 28 May 2008)
Log Message:
-----------
reverting due to PDF problem
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-28 16:41:21 UTC (rev 5287)
+++ trunk/matplotlib/CHANGELOG 2008-05-28 16:44:32 UTC (rev 5288)
@@ -1,4 +1,5 @@
-2008-05-28 Replaced '-' with u'\u2212' for minus sign as requested in
+2008-05-28 REVERTING due to PDF problem. Replaced '-' with u'\u2212'
+ for minus sign as requested in
http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720
2008-05-28 zero width/height Rectangles no longer influence the
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 16:41:21 UTC (rev 5287)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 16:44:32 UTC (rev 5288)
@@ -408,7 +408,8 @@
def pprint_val(self, x):
xp = (x-self.offset)/10**self.orderOfMagnitude
if np.absolute(xp) < 1e-8: xp = 0
- return (self.format % xp).replace('-', u'\u2212')
+ #return (self.format % xp).replace('-', u'\u2212') # crashes PDF
+ return self.format % xp
def _formatSciNotation(self, s):
# transform 1e+004 into 1e4, for example
@@ -428,7 +429,8 @@
else:
return r'%s%s'%(significand, exponent)
else:
- return (u'%se%s%s' %(significand, sign.replace('-', u'\u2212'), exponent)).rstrip('e')
+ sign = sign.replace('-', u'\u2212') # crashes PDF
+ return ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
except IndexError, msg:
return s
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-05-28 16:41:23
|
Revision: 5287
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5287&view=rev
Author: jdh2358
Date: 2008-05-28 09:41:21 -0700 (Wed, 28 May 2008)
Log Message:
-----------
use unicode minus rather than hyphen
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-05-28 15:33:03 UTC (rev 5286)
+++ trunk/matplotlib/CHANGELOG 2008-05-28 16:41:21 UTC (rev 5287)
@@ -1,3 +1,6 @@
+2008-05-28 Replaced '-' with u'\u2212' for minus sign as requested in
+ http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720
+
2008-05-28 zero width/height Rectangles no longer influence the
autoscaler. Useful for log histograms with empty bins -
JDH
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 15:33:03 UTC (rev 5286)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-05-28 16:41:21 UTC (rev 5287)
@@ -408,7 +408,7 @@
def pprint_val(self, x):
xp = (x-self.offset)/10**self.orderOfMagnitude
if np.absolute(xp) < 1e-8: xp = 0
- return self.format % xp
+ return (self.format % xp).replace('-', u'\u2212')
def _formatSciNotation(self, s):
# transform 1e+004 into 1e4, for example
@@ -422,13 +422,13 @@
# reformat 1x10^y as 10^y
significand = ''
if exponent:
- exponent = '10^{%s%s}'%(sign, exponent)
+ exponent = u'10^{%s%s}'%(sign, exponent)
if significand and exponent:
return r'%s{\times}%s'%(significand, exponent)
else:
return r'%s%s'%(significand, exponent)
else:
- return ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
+ return (u'%se%s%s' %(significand, sign.replace('-', u'\u2212'), exponent)).rstrip('e')
except IndexError, msg:
return s
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|