Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce3ff89

Browse files
committed
Bugfix for broken_barh demo
svn path=/branches/transforms/; revision=4592
1 parent 7e1470f commit ce3ff89

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

lib/matplotlib/collections.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Collection(artist.Artist, cm.ScalarMappable):
5454
_offsets = npy.array([], npy.float_)
5555
_transOffset = transforms.IdentityTransform()
5656
_transforms = []
57-
57+
5858
zorder = 1
5959
def __init__(self,
6060
edgecolors=None,
@@ -82,7 +82,7 @@ def __init__(self,
8282
if linewidths is None: linewidths = (mpl.rcParams['patch.linewidth'],)
8383
if antialiaseds is None: antialiaseds = (mpl.rcParams['patch.antialiased'],)
8484
self.set_linestyles(linestyles)
85-
85+
8686
self._facecolors = _colors.colorConverter.to_rgba_array(facecolors)
8787
if edgecolors == 'None':
8888
self._edgecolors = self._facecolors
@@ -117,13 +117,13 @@ def _get_value(self, val):
117117
else: return val
118118

119119
raise TypeError('val must be a float or nonzero sequence of floats')
120-
120+
121121
def get_paths(self):
122122
raise NotImplementedError
123123

124124
def get_transforms(self):
125125
return self._transforms
126-
126+
127127
def get_datalim(self, transData):
128128
transform = self.get_transform()
129129
transOffset = self._transOffset
@@ -136,7 +136,7 @@ def get_datalim(self, transData):
136136
offsets = transOffset.transform_non_affine(offsets)
137137
transOffset = transOffset.get_affine()
138138
offsets = npy.asarray(offsets, npy.float_)
139-
139+
140140
result = mpath.get_path_collection_extents(
141141
transform.frozen(), paths, self.get_transforms(),
142142
offsets, transOffset.frozen())
@@ -163,26 +163,26 @@ def draw(self, renderer):
163163
xs = self.convert_xunits(self._offsets[:0])
164164
ys = self.convert_yunits(self._offsets[:1])
165165
offsets = zip(xs, ys)
166-
166+
167167
offsets = npy.asarray(offsets, npy.float_)
168168

169169
self.update_scalarmappable()
170170

171171
clippath, clippath_trans = self.get_transformed_clip_path_and_affine()
172172
if clippath_trans is not None:
173173
clippath_trans = clippath_trans.frozen()
174-
174+
175175
if not transform.is_affine:
176176
paths = [transform.transform_path_non_affine(path) for path in paths]
177177
transform = transform.get_affine()
178178
if not transOffset.is_affine:
179179
offsets = transOffset.transform_non_affine(offsets)
180180
transOffset = transOffset.get_affine()
181-
181+
182182
renderer.draw_path_collection(
183183
transform.frozen(), self.clipbox, clippath, clippath_trans,
184184
paths, self.get_transforms(),
185-
offsets, transOffset,
185+
offsets, transOffset,
186186
self._facecolors, self._edgecolors, self._linewidths,
187187
self._linestyles, self._antialiaseds)
188188
renderer.close_group(self.__class__.__name__)
@@ -210,7 +210,7 @@ def contains(self, mouseevent):
210210

211211
def set_pickradius(self,pickradius): self.pickradius = 5
212212
def get_pickradius(self): return self.pickradius
213-
213+
214214
def set_linewidths(self, lw):
215215
"""
216216
Set the linewidth(s) for the collection. lw can be a scalar or a
@@ -221,7 +221,7 @@ def set_linewidths(self, lw):
221221
"""
222222
self._linewidths = self._get_value(lw)
223223
set_lw = set_linewidth = set_linewidths
224-
224+
225225
def set_linestyles(self, ls):
226226
"""
227227
Set the linestyles(s) for the collection.
@@ -251,7 +251,7 @@ def set_linestyles(self, ls):
251251
raise ValueError('Do not know how to convert %s to dashes'%ls)
252252
self._linestyles = dashes
253253
set_dashes = set_linestyle = set_linestyles
254-
254+
255255
def set_color(self, c):
256256
"""
257257
Set both the edgecolor and the facecolor.
@@ -307,11 +307,11 @@ def set_alpha(self, alpha):
307307
def get_linewidths(self):
308308
return self._linewidths
309309
get_linewidth = get_linewidths
310-
310+
311311
def get_linestyles(self):
312312
return self._linestyles
313313
get_dashes = get_linestyle = get_linestyles
314-
314+
315315
def update_scalarmappable(self):
316316
"""
317317
If the scalar mappable array is not none, update colors
@@ -348,7 +348,7 @@ def update_scalarmappable(self):
348348
None, they default to their patch.* rc params setting, in sequence
349349
form.
350350
"""
351-
351+
352352
class QuadMesh(Collection):
353353
"""
354354
Class for the efficient drawing of a quadrilateral mesh.
@@ -391,7 +391,7 @@ def __init__(self, meshWidth, meshHeight, coordinates, showedges, antialiased=Tr
391391
# By converting to floats now, we can avoid that on every draw.
392392
self._coordinates = self._coordinates.reshape((meshHeight + 1, meshWidth + 1, 2))
393393
self._coordinates = npy.array(self._coordinates, npy.float_)
394-
394+
395395
def get_paths(self, dataTrans=None):
396396
if self._paths is None:
397397
self._paths = self.convert_mesh_to_paths(
@@ -401,14 +401,14 @@ def get_paths(self, dataTrans=None):
401401
#@staticmethod
402402
def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
403403
Path = mpath.Path
404-
404+
405405
c = coordinates
406406
# We could let the Path constructor generate the codes for us,
407407
# but this is faster, since we know they'll always be the same
408408
codes = npy.array(
409409
[Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY],
410410
Path.code_type)
411-
411+
412412
points = npy.concatenate((
413413
c[0:-1, 0:-1],
414414
c[0:-1, 1: ],
@@ -419,10 +419,10 @@ def convert_mesh_to_paths(meshWidth, meshHeight, coordinates):
419419
points = points.reshape((meshWidth * meshHeight, 5, 2))
420420
return [Path(x, codes) for x in points]
421421
convert_mesh_to_paths = staticmethod(convert_mesh_to_paths)
422-
422+
423423
def get_datalim(self, transData):
424424
return self._bbox
425-
425+
426426
def draw(self, renderer):
427427
if not self.get_visible(): return
428428
renderer.open_group(self.__class__.__name__)
@@ -444,7 +444,7 @@ def draw(self, renderer):
444444
clippath, clippath_trans = self.get_transformed_clip_path_and_affine()
445445
if clippath_trans is not None:
446446
clippath_trans = clippath_trans.frozen()
447-
447+
448448
assert transform.is_affine
449449
if not transOffset.is_affine:
450450
offsets = transOffset.transform_non_affine(offsets)
@@ -478,7 +478,7 @@ def set_verts(self, verts):
478478

479479
def get_paths(self):
480480
return self._paths
481-
481+
482482
class BrokenBarHCollection(PolyCollection):
483483
"""
484484
A colleciton of horizontal bars spanning yrange with a sequence of
@@ -493,13 +493,13 @@ def __init__(self, xranges, yrange, **kwargs):
493493
"""
494494
ymin, ywidth = yrange
495495
ymax = ymin + ywidth
496-
verts = [ [(xmin, ymin), (xmin, ymax), (xmin+xwidth, ymax), (xmin+xwidth, ymin)] for xmin, xwidth in xranges]
496+
verts = [ [(xmin, ymin), (xmin, ymax), (xmin+xwidth, ymax), (xmin+xwidth, ymin), (xmin, ymin)] for xmin, xwidth in xranges]
497497
PolyCollection.__init__(self, verts, **kwargs)
498498
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
499499

500500
class RegularPolyCollection(Collection):
501501
_path_generator = mpath.Path.unit_regular_polygon
502-
502+
503503
def __init__(self,
504504
dpi,
505505
numsides,
@@ -550,7 +550,7 @@ def __init__(self,
550550
(math.sqrt(x) * self._dpi / 72.0) / math.sqrt(math.pi))
551551
for x in sizes]
552552
self.set_transform(transforms.IdentityTransform())
553-
553+
554554
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
555555

556556
def get_paths(self):
@@ -559,12 +559,12 @@ def get_paths(self):
559559

560560
class StarPolygonCollection(RegularPolyCollection):
561561
_path_generator = mpath.Path.unit_regular_star
562-
563-
562+
563+
564564
class AsteriskPolygonCollection(RegularPolyCollection):
565565
_path_generator = mpath.Path.unit_regular_asterisk
566-
567-
566+
567+
568568
class LineCollection(Collection, cm.ScalarMappable):
569569
"""
570570
All parameters must be sequences or scalars; if scalars, they will
@@ -630,7 +630,7 @@ def __init__(self, segments, # Can be None.
630630
self.set_linestyles(linestyles)
631631

632632
colors = _colors.colorConverter.to_rgba_array(colors)
633-
633+
634634
Collection.__init__(
635635
self,
636636
edgecolors=colors,
@@ -649,14 +649,14 @@ def __init__(self, segments, # Can be None.
649649

650650
def get_paths(self):
651651
return self._paths
652-
652+
653653
def set_segments(self, segments):
654654
if segments is None: return
655655
segments = [npy.asarray(seg, npy.float_) for seg in segments]
656656
if self._uniform_offsets is not None:
657657
segments = self._add_offsets(segments)
658658
self._paths = [mpath.Path(seg) for seg in segments]
659-
659+
660660
set_verts = set_segments # for compatibility with PolyCollection
661661

662662
def _add_offsets(self, segs):

0 commit comments

Comments
 (0)