@@ -19,10 +19,8 @@ def __init__(self):
19
19
self .height = 600
20
20
self .color_discrete_sequence = None
21
21
self .color_continuous_scale = None
22
- self .symbol_sequence = ["circle" , "diamond" , "square" , "x" , "cross" ]
23
- self .line_dash_sequence = ["solid" , "dot" , "dash" , "longdash" , "dashdot" ] + [
24
- "longdashdot"
25
- ]
22
+ self .symbol_sequence = None
23
+ self .line_dash_sequence = None
26
24
self .size_max = 20
27
25
28
26
@@ -673,6 +671,37 @@ def apply_default_cascade(args):
673
671
if args ["color_discrete_sequence" ] is None :
674
672
args ["color_discrete_sequence" ] = qualitative .D3
675
673
674
+ # if symbol_sequence/line_dash_sequence not set explicitly or in px.defaults,
675
+ # see if we can defer to template. If not, set reasonable defaults
676
+ if "symbol_sequence" in args :
677
+ if args ["symbol_sequence" ] is None :
678
+ try :
679
+ args ["symbol_sequence" ] = [
680
+ scatter .marker .symbol for scatter in template .data .scatter
681
+ ]
682
+ except (AttributeError , TypeError ):
683
+ pass
684
+ if not args ["symbol_sequence" ] or not any (args ["symbol_sequence" ]):
685
+ args ["symbol_sequence" ] = ["circle" , "diamond" , "square" , "x" , "cross" ]
686
+
687
+ if "line_dash_sequence" in args :
688
+ if args ["line_dash_sequence" ] is None :
689
+ try :
690
+ args ["line_dash_sequence" ] = [
691
+ scatter .line .dash for scatter in template .data .scatter
692
+ ]
693
+ except (AttributeError , TypeError ):
694
+ pass
695
+ if not args ["line_dash_sequence" ] or not any (args ["line_dash_sequence" ]):
696
+ args ["line_dash_sequence" ] = [
697
+ "solid" ,
698
+ "dot" ,
699
+ "dash" ,
700
+ "longdash" ,
701
+ "dashdot" ,
702
+ "longdashdot" ,
703
+ ]
704
+
676
705
# If both marginals and faceting are specified, faceting wins
677
706
if args .get ("facet_col" , None ) and args .get ("marginal_y" , None ):
678
707
args ["marginal_y" ] = None
0 commit comments