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):
641
641
"""
642
642
self ._capstyle = CapStyle (cs )
643
643
644
+ @_docstring .interpd
644
645
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
646
654
647
655
@_docstring .interpd
648
656
def set_joinstyle (self , js ):
@@ -655,8 +663,16 @@ def set_joinstyle(self, js):
655
663
"""
656
664
self ._joinstyle = JoinStyle (js )
657
665
666
+ @_docstring .interpd
658
667
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
660
676
661
677
@staticmethod
662
678
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):
51
51
def set_linewidth (self , lw : float | Sequence [float ]) -> None : ...
52
52
def set_linestyle (self , ls : LineStyleType | Sequence [LineStyleType ]) -> None : ...
53
53
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 : ...
55
55
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 : ...
57
57
def set_antialiased (self , aa : bool | Sequence [bool ]) -> None : ...
58
58
def get_antialiased (self ) -> NDArray [np .bool_ ]: ...
59
59
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():
625
625
626
626
@mpl .style .context ('default' )
627
627
def test_capstyle ():
628
+ col = mcollections .PathCollection ([])
629
+ assert col .get_capstyle () is None
628
630
col = mcollections .PathCollection ([], capstyle = 'round' )
629
631
assert col .get_capstyle () == 'round'
630
632
col .set_capstyle ('butt' )
@@ -633,6 +635,8 @@ def test_capstyle():
633
635
634
636
@mpl .style .context ('default' )
635
637
def test_joinstyle ():
638
+ col = mcollections .PathCollection ([])
639
+ assert col .get_joinstyle () is None
636
640
col = mcollections .PathCollection ([], joinstyle = 'round' )
637
641
assert col .get_joinstyle () == 'round'
638
642
col .set_joinstyle ('miter' )
You can’t perform that action at this time.
0 commit comments