|
From: <jd...@us...> - 2007-09-04 14:52:18
|
Revision: 3774
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3774&view=rev
Author: jdh2358
Date: 2007-09-04 07:52:03 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
added manuels star poly patch
Modified Paths:
--------------
trunk/matplotlib/examples/scatter_star_poly.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/collections.py
trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
trunk/matplotlib/lib/matplotlib/pylab.py
trunk/matplotlib/mpl1/mpl1.py
Modified: trunk/matplotlib/examples/scatter_star_poly.py
===================================================================
--- trunk/matplotlib/examples/scatter_star_poly.py 2007-09-04 05:58:48 UTC (rev 3773)
+++ trunk/matplotlib/examples/scatter_star_poly.py 2007-09-04 14:52:03 UTC (rev 3774)
@@ -3,19 +3,25 @@
x = pylab.nx.mlab.rand(10)
y = pylab.nx.mlab.rand(10)
-pylab.subplot(221)
+pylab.subplot(321)
pylab.scatter(x,y,s=80,marker=">")
-pylab.subplot(222)
+pylab.subplot(322)
pylab.scatter(x,y,s=80,marker=(5,0))
verts = zip([-1.,1.,1.],[-1.,-1.,1.])
-pylab.subplot(223)
+pylab.subplot(323)
pylab.scatter(x,y,s=80,marker=(verts,0))
# equivalent:
#pylab.scatter(x,y,s=80,marker=None, verts=verts)
-pylab.subplot(224)
+pylab.subplot(324)
pylab.scatter(x,y,s=80,marker=(5,1))
+pylab.subplot(325)
+pylab.scatter(x,y,s=80,marker='+')
+
+pylab.subplot(326)
+pylab.scatter(x,y,s=80,marker=(5,2), edgecolor='g')
+
pylab.show()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2007-09-04 05:58:48 UTC (rev 3773)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2007-09-04 14:52:03 UTC (rev 3774)
@@ -3976,16 +3976,18 @@
if not self._hold: self.cla()
syms = { # a dict from symbol to (numsides, angle)
- 's' : (4, math.pi/4.0), # square
- 'o' : (20, 0), # circle
- '^' : (3,0), # triangle up
- '>' : (3,math.pi/2.0), # triangle right
- 'v' : (3,math.pi), # triangle down
- '<' : (3,3*math.pi/2.0), # triangle left
- 'd' : (4,0), # diamond
- 'p' : (5,0), # pentagram
- 'h' : (6,0), # hexagon
- '8' : (8,0), # octagon
+ 's' : (4,math.pi/4.0,0), # square
+ 'o' : (20,0,0), # circle
+ '^' : (3,0,0), # triangle up
+ '>' : (3,math.pi/2.0,0), # triangle right
+ 'v' : (3,math.pi,0), # triangle down
+ '<' : (3,3*math.pi/2.0,0), # triangle left
+ 'd' : (4,0,0), # diamond
+ 'p' : (5,0,0), # pentagram
+ 'h' : (6,0,0), # hexagon
+ '8' : (8,0,0), # octagon
+ '+' : (4,0,2), # plus
+ 'x' : (4,math.pi/4.0,2) # cross
}
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
@@ -4013,7 +4015,7 @@
else: edgecolors = 'None'
sym = None
- starlike = False
+ symstyle = 0
# to be API compatible
if marker is None and not (verts is None):
@@ -4025,7 +4027,7 @@
sym = syms.get(marker)
if sym is None and verts is None:
raise ValueError('Unknown marker symbol to scatter')
- numsides, rotation = syms[marker]
+ numsides, rotation, symstyle = syms[marker]
elif iterable(marker):
# accept marker to be:
@@ -4040,21 +4042,19 @@
# (numsides, style, [angle])
if len(marker)==2:
- numsides, rotation = marker[0], math.pi/4.
+ numsides, rotation = marker[0], 0.
elif len(marker)==3:
numsides, rotation = marker[0], marker[2]
sym = True
- if marker[1]==1:
- # starlike symbol, everthing else is interpreted
- # as solid symbol
- starlike = True
+ if marker[1] in (1,2):
+ symstyle = marker[1]
else:
verts = npy.asarray(marker[0])
if sym is not None:
- if not starlike:
+ if symstyle==0:
collection = mcoll.RegularPolyCollection(
self.figure.dpi,
@@ -4065,7 +4065,7 @@
offsets = zip(x,y),
transOffset = self.transData,
)
- else:
+ elif symstyle==1:
collection = mcoll.StarPolygonCollection(
self.figure.dpi,
numsides, rotation, scales,
@@ -4075,6 +4075,16 @@
offsets = zip(x,y),
transOffset = self.transData,
)
+ elif symstyle==2:
+ collection = mcoll.AsteriskPolygonCollection(
+ self.figure.dpi,
+ numsides, rotation, scales,
+ facecolors = colors,
+ edgecolors = edgecolors,
+ linewidths = linewidths,
+ offsets = zip(x,y),
+ transOffset = self.transData,
+ )
else:
# rescale verts
rescale = npy.sqrt(max(verts[:,0]**2+verts[:,1]**2))
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2007-09-04 05:58:48 UTC (rev 3773)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2007-09-04 14:52:03 UTC (rev 3774)
@@ -568,9 +568,42 @@
ns2 = self.numsides*2
r = scale*npy.ones(ns2)
r[1::2] *= 0.5
- theta = (2.*math.pi/(ns2))*npy.arange(ns2) + self.rotation
+ theta = (math.pi/self.numsides)*npy.arange(ns2) + self.rotation
self._verts = zip( r*npy.sin(theta), r*npy.cos(theta) )
+class AsteriskPolygonCollection(RegularPolyCollection):
+ def __init__(self,
+ dpi,
+ numsides,
+ rotation = 0 ,
+ sizes = (1,),
+ **kwargs):
+ """
+ Draw a regular asterisk Polygone with numsides spikes.
+
+ * dpi is the figure dpi instance, and is required to do the
+ area scaling.
+
+ * numsides: the number of spikes of the polygon
+
+ * sizes gives the area of the circle circumscribing the
+ regular polygon in points^2
+
+ * rotation is the rotation of the polygon in radians
+
+ %(PatchCollection)s
+ """
+
+ RegularPolyCollection.__init__(self, dpi, numsides, rotation, sizes, **kwargs)
+ __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
+
+ def _update_verts(self):
+ scale = 1.0/math.sqrt(math.pi)
+ r = scale*npy.ones(self.numsides*2)
+ r[1::2] = 0
+ theta = (math.pi/self.numsides)*npy.arange(2*self.numsides) + self.rotation
+ self._verts = zip( r*npy.sin(theta), r*npy.cos(theta) )
+
class LineCollection(Collection, cm.ScalarMappable):
"""
All parameters must be sequences or scalars; if scalars, they will
Modified: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
===================================================================
--- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc 2007-09-04 05:58:48 UTC (rev 3773)
+++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc 2007-09-04 14:52:03 UTC (rev 3774)
@@ -26,7 +26,7 @@
#### CONFIGURATION BEGINS HERE
# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg
# Agg Cairo GD GDK Paint PS PDF SVG Template
-backend : WXAgg
+backend : TkAgg
numerix : numpy # numpy, Numeric or numarray
#maskedarray : False # True to use external maskedarray module
# instead of numpy.ma; this is a temporary
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py 2007-09-04 05:58:48 UTC (rev 3773)
+++ trunk/matplotlib/lib/matplotlib/pylab.py 2007-09-04 14:52:03 UTC (rev 3774)
@@ -1464,8 +1464,8 @@
is either an int or a string. if it is an int, it indicates the
column number. If it is a string, it indicates the column header.
mpl will make column headers lower case, replace spaces with
- strings, and remove all illegal characters; so 'Adj Close*' will
- have name 'adj_close'
+ underscores, and remove all illegal characters; so 'Adj Close*'
+ will have name 'adj_close'
if len(cols)==1, only that column will be plotted on the y axis.
if len(cols)>1, the first element will be an identifier for data
@@ -1480,7 +1480,8 @@
names in both.
comments, skiprows, checkrows, and delimiter are all passed on to
- matplotlib.mlab.csv2rec to load the data into a record array
+ matplotlib.mlab.csv2rec to load the data into a record array. See
+ the help there fore more information.
kwargs are passed on to plotting functions
Modified: trunk/matplotlib/mpl1/mpl1.py
===================================================================
--- trunk/matplotlib/mpl1/mpl1.py 2007-09-04 05:58:48 UTC (rev 3773)
+++ trunk/matplotlib/mpl1/mpl1.py 2007-09-04 14:52:03 UTC (rev 3774)
@@ -12,7 +12,7 @@
sudo rm -rf /usr/local/lib/python2.5/site-packages/enthought*
sudo easy_install \
-f http://code.enthought.com/enstaller/eggs/source/unstable \
- "enthought.resource <3.0a" "enthought.traits < 3.0a"
+ "enthought.traits < 3.0a"
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|