@@ -1465,11 +1465,7 @@ def build_dataframe(args, constructor):
1465
1465
1466
1466
if hist1d_orientation :
1467
1467
args ["x" if orient_v else "y" ] = value_name
1468
- if wide_cross_name is None and constructor == go .Scatter :
1469
- args ["y" if orient_v else "x" ] = count_name
1470
- df_output [count_name ] = 1
1471
- else :
1472
- args ["y" if orient_v else "x" ] = wide_cross_name
1468
+ args ["y" if orient_v else "x" ] = wide_cross_name
1473
1469
args ["color" ] = args ["color" ] or var_name
1474
1470
elif constructor in [go .Scatter , go .Funnel ] + hist2d_types :
1475
1471
args ["x" if orient_v else "y" ] = wide_cross_name
@@ -1491,6 +1487,21 @@ def build_dataframe(args, constructor):
1491
1487
elif constructor in [go .Violin , go .Box ]:
1492
1488
args ["x" if orient_v else "y" ] = wide_cross_name or var_name
1493
1489
args ["y" if orient_v else "x" ] = value_name
1490
+
1491
+ if hist1d_orientation and constructor == go .Scatter :
1492
+ if args ["x" ] is not None and args ["y" ] is not None :
1493
+ args ["histfunc" ] = "sum"
1494
+ elif args ["x" ] is None :
1495
+ args ["histfunc" ] = None
1496
+ args ["orientation" ] = "h"
1497
+ args ["x" ] = count_name
1498
+ df_output [count_name ] = 1
1499
+ else :
1500
+ args ["histfunc" ] = None
1501
+ args ["orientation" ] = "v"
1502
+ args ["y" ] = count_name
1503
+ df_output [count_name ] = 1
1504
+
1494
1505
if no_color :
1495
1506
args ["color" ] = None
1496
1507
args ["data_frame" ] = df_output
@@ -1788,7 +1799,9 @@ def infer_config(args, constructor, trace_patch, layout_patch):
1788
1799
trace_patch ["opacity" ] = args ["opacity" ]
1789
1800
else :
1790
1801
trace_patch ["marker" ] = dict (opacity = args ["opacity" ])
1791
- if "line_group" in args : # px.line, px.line_*, px.area
1802
+ if (
1803
+ "line_group" in args or "line_dash" in args
1804
+ ): # px.line, px.line_*, px.area, px.ecdf, px, kde
1792
1805
modes = set (["lines" ])
1793
1806
if args .get ("text" ) or args .get ("symbol" ) or args .get ("markers" ):
1794
1807
modes .add ("markers" )
@@ -2061,7 +2074,17 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
2061
2074
base = args ["x" ] if args ["orientation" ] == "v" else args ["y" ]
2062
2075
var = args ["x" ] if args ["orientation" ] == "h" else args ["y" ]
2063
2076
group = group .sort_values (by = base )
2077
+ group_sum = group [var ].sum ()
2064
2078
group [var ] = group [var ].cumsum ()
2079
+ if args ["complementary" ]:
2080
+ group [var ] = group_sum - group [var ]
2081
+
2082
+ if args ["norm" ] == "probability" :
2083
+ group [var ] = group [var ] / group_sum
2084
+ elif args ["norm" ] == "percent" :
2085
+ group [var ] = 100.0 * group [var ] / group_sum
2086
+ args ["histnorm" ] = args ["norm" ]
2087
+ # TODO norm, including histnorm-like naming
2065
2088
2066
2089
patch , fit_results = make_trace_kwargs (
2067
2090
args , trace_spec , group , mapping_labels .copy (), sizeref
0 commit comments