10000 Fix shadows (see pie_demo.py) · adrn/matplotlib@06527d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 06527d8

Browse files
committed
Fix shadows (see pie_demo.py)
svn path=/branches/transforms/; revision=4525
1 parent 340a5ea commit 06527d8

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

lib/matplotlib/patches.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self,
7171
self._hatch = hatch
7272
self._combined_transform = transforms.IdentityTransform()
7373
self.fill = fill
74-
74+
7575
if len(kwargs): artist.setp(self, **kwargs)
7676
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
7777

@@ -105,7 +105,7 @@ def update_from(self, other):
105105

106106
def get_extents(self):
107107
return self.get_path().get_extents(self.get_transform())
108-
108+
109109
def get_transform(self):
110110
return self._combined_transform
111111

@@ -116,10 +116,10 @@ def set_transform(self, t):
116116

117117
def get_data_transform(self):
118118
return artist.Artist.get_transform(self)
119-
119+
120120
def get_patch_transform(self):
121121
return transforms.IdentityTransform()
122-
122+
123123
def get_antialiased(self):
124124
return self._antialiased
125125

@@ -155,7 +155,7 @@ def set_facecolor(self, color):
155155
ACCEPTS: any matplotlib color
156156
"""
157157
self._facecolor = color
158-
158+
159159
def set_linewidth(self, w):
160160
"""
161161
Set the patch linewidth in points
@@ -212,7 +212,7 @@ def draw(self, renderer):
212212

213213
if cbook.is_string_like(self._edgecolor) and self._edgecolor.lower()=='none':
214214
gc.set_linewidth(0)
215-
else:
215+
else:
216216
gc.set_foreground(self._edgecolor)
217217
gc.set_linewidth(self._linewidth)
218218

@@ -226,15 +226,15 @@ def draw(self, renderer):
226226
rgbFace = None
227227
else:
228228
rgbFace = colors.colorConverter.to_rgb(self._facecolor)
229-
229+
230230
if self._hatch:
231231
gc.set_hatch(self._hatch )
232232

233233
path = self.get_path()
234234
transform = self.get_transform()
235235
tpath = transform.transform_path_non_affine(path)
236236
affine = transform.get_affine()
237-
237+
238238
renderer.draw_path(gc, tpath, affine, rgbFace)
239239

240240
#renderer.close_group('patch')
@@ -322,25 +322,25 @@ def _update(self):
322322

323323
def _update_transform(self):
324324
self._shadow_transform = transforms.Affine2D().translate(self._ox, self._oy)
325-
325+
326326
def _get_ox(self):
327327
return self._ox
328328
def _set_ox(self, ox):
329329
self._ox = ox
330330
self._update_transform()
331-
331+
332332
def _get_oy(self):
333333
return self._oy
334334
def _set_oy(self, oy):
335335
self._oy = oy
336336
self._update_transform()
337-
337+
338338
def get_path(self):
339339
return self.patch.get_path()
340340

341341
def get_patch_transform(self):
342-
return self._shadow_transform
343-
342+
return self.patch.get_patch_transform() + self._shadow_transform
343+
344344
class Rectangle(Patch):
345345
"""
346346
Draw a rectangle with lower left at xy=(x,y) with specified
@@ -385,7 +385,7 @@ def contains(self, mouseevent):
385385
x, y = self.get_transform().inverted().transform_point(
386386
(mouseevent.x, mouseevent.y))
387387
return (x >= 0.0 and x <= 1.0 and y >= 0.0 and y <= 1.0), {}
388-
388+
389389
def get_x(self):
390390
"Return the left coord of the rectangle"
391391
return self._bbox.x0
@@ -480,9 +480,9 @@ def __init__(self, xy, numVertices, radius=5, orientation=0,
480480
self._path = Path.unit_regular_polygon(numVertices)
481481
self._poly_transform = transforms.Affine2D()
482482
self._update_transform()
483-
483+
484484
Patch.__init__(self, **kwargs)
485-
485+
486486
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
487487

488488
def _update_transform(self):
@@ -504,7 +504,7 @@ def _set_orientation(self, xy):
504504
self._orientation = xy
505505
self._update_transform()
506506
orientation = property(_get_orientation, _set_orientation)
507-
507+
508508
def _get_radius(self):
509509
return self._radius
510510
def _set_radius(self, xy):
@@ -518,13 +518,13 @@ def _set_numvertices(self, numVertices):
518518
self._numVertices = numVertices
519519
self._path = Path.unit_regular_polygon(numVertices)
520520
numvertices = property(_get_numvertices, _set_numvertices)
521-
521+
522522
def get_path(self):
523523
return self._path
524524

525525
def get_patch_transform(self):
526526
return self._poly_transform
527-
527+
528528
class PathPatch(Patch):
529529
"""
530530
A general polycurve path patch.
@@ -535,7 +535,7 @@ def __str__(self):
535535
def __init__(self, path, **kwargs):
536536
"""
537537
path is a Path object
538-
538+
539539
Valid kwargs are:
540540
%(Patch)s
541541
See Patch documentation for additional kwargs
@@ -574,7 +574,7 @@ def _get_xy(self):
574574
def _set_xy(self, vertices):
575575
self._path = Path(vertices)
576576
xy = property(_get_xy, _set_xy)
577-
577+
578578
class Wedge(Patch):
579579
def __str__(self):
580580
return "Wedge(%g,%g)"%self.xy[0]
@@ -612,7 +612,7 @@ def __str__(self):
612612
[ 0.8, -0.1 ], [ 0.8, -0.3],
613613
[ 1.0, 0.0 ], [ 0.8, 0.3],
614614
[ 0.8, 0.1 ], [ 0.0, 0.1] ] )
615-
615+
616616
def __init__( self, x, y, dx, dy, width=1.0, **kwargs ):
617617
"""Draws an arrow, starting at (x,y), direction and length
618618
given by (dx,dy) the width of the arrow is scaled by width
@@ -636,7 +636,7 @@ def get_path(self):
636636

637637
def get_patch_transform(self):
638638
return self._patch_transform
639-
639+
640640
class FancyArrow(Polygon):
641641
"""Like Arrow, but lets you set head width and head height independently."""
642642

@@ -744,7 +744,7 @@ def __init__(self, dpi, xytip, xybase, width=4, frac=0.1, headwidth=12, **kwargs
744744
def get_path(self):
745745
# Since this is dpi dependent, we need to recompute the path
746746
# every time.
747-
747+
748748
# the base vertices
749749
x1, y1 = self.xytip
750750
x2, y2 = self.xybase
@@ -767,7 +767,7 @@ def get_path(self):
767767

768768
def get_patch_transform(self):
769769
return transforms.IdentityTransform()
770-
770+
771771
def getpoints(self, x1,y1,x2,y2, k):
772772
"""
773773
for line segment defined by x1,y1 and x2,y2, return the points on
@@ -845,7 +845,7 @@ def _recompute_transform(self):
845845
.scale(self._width * 0.5, self._height * 0.5) \
846846
.rotate_deg(self._angle) \
847847
.translate(*self._center)
848-
848+
849849
def get_path(self):
850850
"""
851851
Return the vertices of the rectangle
@@ -854,12 +854,12 @@ def get_path(self):
854854

855855
def get_patch_transform(self):
856856
return self._patch_transform
857-
857+
858858
def contains(self,ev):
859859
if ev.x is None or ev.y is None: return False,{}
860860
x, y = self.get_transform().inverted().transform_point((ev.x, ev.y))
861861
return (x*x + y*y) <= 1.0, {}
862-
862+
863863
def _get_center(self):
864864
return self._center
865865
def _set_center(self, center):
@@ -880,8 +880,8 @@ def _set_angle(self, angle):
880880
self._angle = angle
881881
self._recompute_transform()
882882
angle = property(_get_angle, _set_angle)
883-
884-
883+
884+
885885
class Circle(Ellipse):
886886
"""
887887
A circle patch

0 commit comments

Comments
 (0)
0