File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -641,8 +641,16 @@ def set_capstyle(self, cs):
641641 """
642642 self ._capstyle = CapStyle (cs )
643643
644+ @_docstring .interpd
644645 def get_capstyle (self ):
645- return self ._capstyle .name
646+ """
647+ Return the cap style for the collection (for all its elements).
648+
649+ Returns
650+ -------
651+ %(CapStyle)s or None
652+ """
653+ return self ._capstyle .name if self ._capstyle else None
646654
647655 @_docstring .interpd
648656 def set_joinstyle (self , js ):
@@ -655,8 +663,16 @@ def set_joinstyle(self, js):
655663 """
656664 self ._joinstyle = JoinStyle (js )
657665
666+ @_docstring .interpd
658667 def get_joinstyle (self ):
659- return self ._joinstyle .name
668+ """
669+ Return the join style for the collection (for all its elements).
670+
671+ Returns
672+ -------
673+ %(JoinStyle)s or None
674+ """
675+ return self ._joinstyle .name if self ._joinstyle else None
660676
661677 @staticmethod
662678 def _bcast_lwls (linewidths , dashes ):
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ class Collection(artist.Artist, cm.ScalarMappable):
5151 def set_linewidth (self , lw : float | Sequence [float ]) -> None : ...
5252 def set_linestyle (self , ls : LineStyleType | Sequence [LineStyleType ]) -> None : ...
5353 def set_capstyle (self , cs : CapStyleType ) -> None : ...
54- def get_capstyle (self ) -> Literal ["butt" , "projecting" , "round" ]: ...
54+ def get_capstyle (self ) -> Literal ["butt" , "projecting" , "round" ] | None : ...
5555 def set_joinstyle (self , js : JoinStyleType ) -> None : ...
56- def get_joinstyle (self ) -> Literal ["miter" , "round" , "bevel" ]: ...
56+ def get_joinstyle (self ) -> Literal ["miter" , "round" , "bevel" ] | None : ...
5757 def set_antialiased (self , aa : bool | Sequence [bool ]) -> None : ...
5858 def get_antialiased (self ) -> NDArray [np .bool_ ]: ...
5959 def set_color (self , c : ColorType | Sequence [ColorType ]) -> None : ...
Original file line number Diff line number Diff line change @@ -625,6 +625,8 @@ def test_set_wrong_linestyle():
625625
626626@mpl .style .context ('default' )
627627def test_capstyle ():
628+ col = mcollections .PathCollection ([])
629+ assert col .get_capstyle () is None
628630 col = mcollections .PathCollection ([], capstyle = 'round' )
629631 assert col .get_capstyle () == 'round'
630632 col .set_capstyle ('butt' )
@@ -633,6 +635,8 @@ def test_capstyle():
633635
634636@mpl .style .context ('default' )
635637def test_joinstyle ():
638+ col = mcollections .PathCollection ([])
639+ assert col .get_joinstyle () is None
636640 col = mcollections .PathCollection ([], joinstyle = 'round' )
637641 assert col .get_joinstyle () == 'round'
638642 col .set_joinstyle ('miter' )
You can’t perform that action at this time.
0 commit comments