@@ -660,6 +660,12 @@ def configure_cartesian_axes(args, fig, orders):
660660 if "is_timeline" in args :
661661 fig .update_xaxes (type = "date" )
662662
663+ if "ecdfmode" in args :
664+ if args ["orientation" ] == "v" :
665+ fig .update_yaxes (rangemode = "tozero" )
666+ else :
667+ fig .update_xaxes (rangemode = "tozero" )
668+
663669
664670def configure_ternary_axes (args , fig , orders ):
665671 fig .update_ternaries (
@@ -1313,7 +1319,7 @@ def build_dataframe(args, constructor):
13131319 value_name = None # will likely be "value" in wide_mode
13141320 hist2d_types = [go .Histogram2d , go .Histogram2dContour ]
13151321 hist1d_orientation = (
1316- constructor == go .Histogram or "complementary " in args or "kernel" in args
1322+ constructor == go .Histogram or "ecdfmode " in args or "kernel" in args
13171323 )
13181324 if constructor in cartesians :
13191325 if wide_x and wide_y :
@@ -1802,11 +1808,15 @@ def infer_config(args, constructor, trace_patch, layout_patch):
18021808 if (
18031809 "line_group" in args or "line_dash" in args
18041810 ): # px.line, px.line_*, px.area, px.ecdf, px, kde
1805- modes = set (["lines" ])
1811+ modes = set ()
1812+ if args .get ("lines" , True ):
1813+ modes .add ("lines" )
18061814 if args .get ("text" ) or args .get ("symbol" ) or args .get ("markers" ):
18071815 modes .add ("markers" )
18081816 if args .get ("text" ):
18091817 modes .add ("text" )
1818+ if len (modes ) == 0 :
1819+ modes .add ("lines" )
18101820 trace_patch ["mode" ] = "+" .join (modes )
18111821 elif constructor != go .Splom and (
18121822 "symbol" in args or constructor == go .Scattermapbox
@@ -1856,13 +1866,13 @@ def infer_config(args, constructor, trace_patch, layout_patch):
18561866 if "trendline_options" in args and args ["trendline_options" ] is None :
18571867 args ["trendline_options" ] = dict ()
18581868
1859- if "norm " in args :
1860- if args .get ("norm " , None ) not in [None , "percent" , "probability" ]:
1869+ if "ecdfnorm " in args :
1870+ if args .get ("ecdfnorm " , None ) not in [None , "percent" , "probability" ]:
18611871 raise ValueError (
1862- "`norm ` must be one of None, 'percent' or 'probability'. "
1863- + "'%s' was provided." % args ["norm " ]
1872+ "`ecdfnorm ` must be one of None, 'percent' or 'probability'. "
1873+ + "'%s' was provided." % args ["ecdfnorm " ]
18641874 )
1865- args ["histnorm" ] = args ["norm " ]
1875+ args ["histnorm" ] = args ["ecdfnorm " ]
18661876
18671877 # Compute applicable grouping attributes
18681878 for k in group_attrables :
@@ -2078,18 +2088,22 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
20782088 ):
20792089 trace .update (marker = dict (color = trace .line .color ))
20802090
2081- if "complementary " in args : # ECDF
2091+ if "ecdfmode " in args :
20822092 base = args ["x" ] if args ["orientation" ] == "v" else args ["y" ]
20832093 var = args ["x" ] if args ["orientation" ] == "h" else args ["y" ]
2084- group = group .sort_values (by = base )
2085- group_sum = group [var ].sum ()
2094+ ascending = args .get ("ecdfmode" , "standard" ) != "reversed"
2095+ group = group .sort_values (by = base , ascending = ascending )
2096+ group_sum = group [var ].sum () # compute here before next line mutates
20862097 group [var ] = group [var ].cumsum ()
2087- if args ["complementary" ]:
2098+ if not ascending :
2099+ group = group .sort_values (by = base , ascending = True )
2100+
2101+ if args .get ("ecdfmode" , "standard" ) == "complementary" :
20882102 group [var ] = group_sum - group [var ]
20892103
2090- if args ["norm " ] == "probability" :
2104+ if args ["ecdfnorm " ] == "probability" :
20912105 group [var ] = group [var ] / group_sum
2092- elif args ["norm " ] == "percent" :
2106+ elif args ["ecdfnorm " ] == "percent" :
20932107 group [var ] = 100.0 * group [var ] / group_sum
20942108
20952109 patch , fit_results = make_trace_kwargs (
0 commit comments