Revision: 4592
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4592&view=rev
Author: mdboom
Date: 2007-12-04 12:07:59 -0800 (Tue, 04 Dec 2007)
Log Message:
-----------
Bugfix for broken_barh demo
Modified Paths:
--------------
branches/transforms/lib/matplotlib/collections.py
Modified: branches/transforms/lib/matplotlib/collections.py
===================================================================
--- branches/transforms/lib/matplotlib/collections.py 2007-12-04 20:07:31 UTC
(rev 4591)
+++ branches/transforms/lib/matplotlib/collections.py 2007-12-04 20:07:59 UTC
(rev 4592)
@@ -54,7 +54,7 @@
_offsets = npy.array([], npy.float_)
_transOffset = transforms.IdentityTransform()
_transforms = []
-
+
zorder = 1
def __init__(self,
edgecolors=None,
@@ -82,7 +82,7 @@
if linewidths is None: linewidths = (mpl.rcParams['patch.linewidth'],)
if antialiaseds is None: antialiaseds =
(mpl.rcParams['patch.antialiased'],)
self.set_linestyles(linestyles)
-
+
self._facecolors = _colors.colorConverter.to_rgba_array(facecolors)
if edgecolors == 'None':
self._edgecolors = self._facecolors
@@ -117,13 +117,13 @@
else: return val
raise TypeError('val must be a float or nonzero sequence of floats')
-
+
def get_paths(self):
raise NotImplementedError
def get_transforms(self):
return self._transforms
-
+
def get_datalim(self, transData):
transform = self.get_transform()
transOffset = self._transOffset
@@ -136,7 +136,7 @@
offsets = transOffset.transform_non_affine(offsets)
transOffset = transOffset.get_affine()
offsets = npy.asarray(offsets, npy.float_)
-
+
result = mpath.get_path_collection_extents(
transform.frozen(), paths, self.get_transforms(),
offsets, transOffset.frozen())
@@ -163,7 +163,7 @@
xs = self.convert_xunits(self._offsets[:0])
ys = self.convert_yunits(self._offsets[:1])
offsets = zip(xs, ys)
-
+
offsets = npy.asarray(offsets, npy.float_)
self.update_scalarmappable()
@@ -171,18 +171,18 @@
clippath, clippath_trans = self.get_transformed_clip_path_and_affine()
if clippath_trans is not None:
clippath_trans = clippath_trans.frozen()
-
+
if not transform.is_affine:
paths = [transform.transform_path_non_affine(path) for path in
paths]
transform = transform.get_affine()
if not transOffset.is_affine:
offsets = transOffset.transform_non_affine(offsets)
transOffset = transOffset.get_affine()
-
+
renderer.draw_path_collection(
transform.frozen(), self.clipbox, clippath, clippath_trans,
paths, self.get_transforms(),
- offsets, transOffset,
+ offsets, transOffset,
self._facecolors, self._edgecolors, self._linewidths,
self._linestyles, self._antialiaseds)
renderer.close_group(self.__class__.__name__)
@@ -210,7 +210,7 @@
def set_pickradius(self,pickradius): self.pickradius = 5
def get_pickradius(self): return self.pickradius
-
+
def set_linewidths(self, lw):
"""
Set the linewidth(s) for the collection. lw can be a scalar or a
@@ -221,7 +221,7 @@
"""
self._linewidths = self._get_value(lw)
set_lw = set_linewidth = set_linewidths
-
+
def set_linestyles(self, ls):
"""
Set the linestyles(s) for the collection.
@@ -251,7 +251,7 @@
raise ValueError('Do not know how to convert %s to dashes'%ls)
self._linestyles = dashes
set_dashes = set_linestyle = set_linestyles
-
+
def set_color(self, c):
"""
Set both the edgecolor and the facecolor.
@@ -307,11 +307,11 @@
def get_linewidths(self):
return self._linewidths
get_linewidth = get_linewidths
-
+
def get_linestyles(self):
return self._linestyles
get_dashes = get_linestyle = get_linestyles
-
+
def update_scalarmappable(self):
"""
If the scalar mappable array is not none, update colors
@@ -348,7 +348,7 @@
None, they default to their patch.* rc params setting, in sequence
form.
"""
-
+
class QuadMesh(Collection):
"""
Class for the efficient drawing of a quadrilateral mesh.
@@ -391,7 +391,7 @@
# By converting to floats now, we can avoid that on every draw.
self._coordinates = self._coordinates.reshape((meshHeight + 1,
meshWidth + 1, 2))
self._coordinates = npy.array(self._coordinates, npy.float_)
-
+
def get_paths(self, dataTrans=None):
if self._paths is None:
self._paths = self.convert_mesh_to_paths(
@@ -401,14 +401,14 @@
[EMAIL PROTECTED]
def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
Path = mpath.Path
-
+
c = coordinates
# We could let the Path constructor generate the codes for us,
# but this is faster, since we know they'll always be the same
codes = npy.array(
[Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO,
Path.CLOSEPOLY],
Path.code_type)
-
+
points = npy.concatenate((
c[0:-1, 0:-1],
c[0:-1, 1: ],
@@ -419,10 +419,10 @@
points = points.reshape((meshWidth * meshHeight, 5, 2))
return [Path(x, codes) for x in points]
convert_mesh_to_paths = staticmethod(convert_mesh_to_paths)
-
+
def get_datalim(self, transData):
return self._bbox
-
+
def draw(self, renderer):
if not self.get_visible(): return
renderer.open_group(self.__class__.__name__)
@@ -444,7 +444,7 @@
clippath, clippath_trans = self.get_transformed_clip_path_and_affine()
if clippath_trans is not None:
clippath_trans = clippath_trans.frozen()
-
+
assert transform.is_affine
if not transOffset.is_affine:
offsets = transOffset.transform_non_affine(offsets)
@@ -478,7 +478,7 @@
def get_paths(self):
return self._paths
-
+
class BrokenBarHCollection(PolyCollection):
"""
A colleciton of horizontal bars spanning yrange with a sequence of
@@ -493,13 +493,13 @@
"""
ymin, ywidth = yrange
ymax = ymin + ywidth
- verts = [ [(xmin, ymin), (xmin, ymax), (xmin+xwidth, ymax),
(xmin+xwidth, ymin)] for xmin, xwidth in xranges]
+ verts = [ [(xmin, ymin), (xmin, ymax), (xmin+xwidth, ymax),
(xmin+xwidth, ymin), (xmin, ymin)] for xmin, xwidth in xranges]
PolyCollection.__init__(self, verts, **kwargs)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
class RegularPolyCollection(Collection):
_path_generator = mpath.Path.unit_regular_polygon
-
+
def __init__(self,
dpi,
numsides,
@@ -550,7 +550,7 @@
(math.sqrt(x) * self._dpi / 72.0) / math.sqrt(math.pi))
for x in sizes]
self.set_transform(transforms.IdentityTransform())
-
+
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
def get_paths(self):
@@ -559,12 +559,12 @@
class StarPolygonCollection(RegularPolyCollection):
_path_generator = mpath.Path.unit_regular_star
-
-
+
+
class AsteriskPolygonCollection(RegularPolyCollection):
_path_generator = mpath.Path.unit_regular_asterisk
-
-
+
+
class LineCollection(Collection, cm.ScalarMappable):
"""
All parameters must be sequences or scalars; if scalars, they will
@@ -630,7 +630,7 @@
self.set_linestyles(linestyles)
colors = _colors.colorConverter.to_rgba_array(colors)
-
+
Collection.__init__(
self,
edgecolors=colors,
@@ -649,14 +649,14 @@
def get_paths(self):
return self._paths
-
+
def set_segments(self, segments):
if segments is None: return
segments = [npy.asarray(seg, npy.float_) for seg in segments]
if self._uniform_offsets is not None:
segments = self._add_offsets(segments)
self._paths = [mpath.Path(seg) for seg in segments]
-
+
set_verts = set_segments # for compatibility with PolyCollection
def _add_offsets(self, segs):
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins