3030          alpha               float 
3131          animated            [True | False] 
3232          antialiased or aa   [True | False] 
33+           capstyle            ['butt' | 'round' | 'projecting'] 
3334          clip_box            a matplotlib.transform.Bbox instance 
3435          clip_on             [True | False] 
3536          edgecolor or ec     any matplotlib color 
3637          facecolor or fc     any matplotlib color 
3738          figure              a matplotlib.figure.Figure instance 
3839          fill                [True | False] 
3940          hatch               unknown 
41+           joinstyle           ['miter' | 'round' | 'bevel'] 
4042          label               any string 
4143          linewidth or lw     float 
4244          lod                 [True | False] 
@@ -56,6 +58,8 @@ class Patch(artist.Artist):
5658    are *None*, they default to their rc params setting. 
5759    """ 
5860    zorder  =  1 
61+     validCap  =  ('butt' , 'round' , 'projecting' )
62+     validJoin  =  ('miter' , 'round' , 'bevel' )
5963
6064    def  __str__ (self ):
6165        return  str (self .__class__ ).split ('.' )[- 1 ]
@@ -69,6 +73,8 @@ def __init__(self,
6973                 antialiased = None ,
7074                 hatch = None ,
7175                 fill = True ,
76+                  capstyle = None ,
77+                  joinstyle = None ,
7278                 ** kwargs ):
7379        """ 
7480        The following kwarg properties are supported 
@@ -81,6 +87,10 @@ def __init__(self,
8187            linewidth  =  mpl .rcParams ['patch.linewidth' ]
8288        if  linestyle  is  None :
8389            linestyle  =  "solid" 
90+         if  capstyle  is  None :
91+             capstyle  =  'butt' 
92+         if  joinstyle  is  None :
93+             joinstyle  =  'miter' 
8494        if  antialiased  is  None :
8595            antialiased  =  mpl .rcParams ['patch.antialiased' ]
8696
@@ -100,6 +110,8 @@ def __init__(self,
100110        self .set_antialiased (antialiased )
101111        self .set_hatch (hatch )
102112        self .set_fill (fill )
113+         self .set_capstyle (capstyle )
114+         self .set_joinstyle (joinstyle )
103115        self ._combined_transform  =  transforms .IdentityTransform ()
104116
105117        if  len (kwargs ):
@@ -355,6 +367,38 @@ def get_fill(self):
355367    # attribute. 
356368    fill  =  property (get_fill , set_fill )
357369
370+     def  set_capstyle (self , s ):
371+         """ 
372+         Set the patch capstyle 
373+ 
374+         ACCEPTS: ['butt' | 'round' | 'projecting'] 
375+         """ 
376+         s  =  s .lower ()
377+         if  s  not  in self .validCap :
378+             raise  ValueError ('set_capstyle passed "%s";\n '  %  (s ,)
379+                              +  'valid capstyles are %s'  %  (self .validCap ,))
380+         self ._capstyle  =  s 
381+ 
382+     def  get_capstyle (self ):
383+         "Return the current capstyle" 
384+         return  self ._capstyle 
385+ 
386+     def  set_joinstyle (self , s ):
387+         """ 
388+         Set the patch joinstyle 
389+ 
390+         ACCEPTS: ['miter' | 'round' | 'bevel'] 
391+         """ 
392+         s  =  s .lower ()
393+         if  s  not  in self .validJoin :
394+             raise  ValueError ('set_joinstyle passed "%s";\n '  %  (s ,)
395+                              +  'valid joinstyles are %s'  %  (self .validJoin ,))
396+         self ._joinstyle  =  s 
397+ 
398+     def  get_joinstyle (self ):
399+         "Return the current joinstyle" 
400+         return  self ._joinstyle 
401+ 
358402    def  set_hatch (self , hatch ):
359403        """ 
360404        Set the hatching pattern 
@@ -403,6 +447,8 @@ def draw(self, renderer):
403447            lw  =  0 
404448        gc .set_linewidth (lw )
405449        gc .set_linestyle (self ._linestyle )
450+         gc .set_capstyle (self ._capstyle )
451+         gc .set_joinstyle (self ._joinstyle )
406452
407453        gc .set_antialiased (self ._antialiased )
408454        self ._set_gc_clip (gc )
0 commit comments