@@ -1469,11 +1469,7 @@ def build_dataframe(args, constructor):
14691469
14701470 if hist1d_orientation :
14711471 args ["x" if orient_v else "y" ] = value_name
1472- if wide_cross_name is None and constructor == go .Scatter :
1473- args ["y" if orient_v else "x" ] = count_name
1474- df_output [count_name ] = 1
1475- else :
1476- args ["y" if orient_v else "x" ] = wide_cross_name
1472+ args ["y" if orient_v else "x" ] = wide_cross_name
14771473 args ["color" ] = args ["color" ] or var_name
14781474 elif constructor in [go .Scatter , go .Funnel ] + hist2d_types :
14791475 args ["x" if orient_v else "y" ] = wide_cross_name
@@ -1495,6 +1491,21 @@ def build_dataframe(args, constructor):
14951491 elif constructor in [go .Violin , go .Box ]:
14961492 args ["x" if orient_v else "y" ] = wide_cross_name or var_name
14971493 args ["y" if orient_v else "x" ] = value_name
1494+
1495+ if hist1d_orientation and constructor == go .Scatter :
1496+ if args ["x" ] is not None and args ["y" ] is not None :
1497+ args ["histfunc" ] = "sum"
1498+ elif args ["x" ] is None :
1499+ args ["histfunc" ] = None
1500+ args ["orientation" ] = "h"
1501+ args ["x" ] = count_name
1502+ df_output [count_name ] = 1
1503+ else :
1504+ args ["histfunc" ] = None
1505+ args ["orientation" ] = "v"
1506+ args ["y" ] = count_name
1507+ df_output [count_name ] = 1
1508+
14981509 if no_color :
14991510 args ["color" ] = None
15001511 args ["data_frame" ] = df_output
@@ -1792,7 +1803,9 @@ def infer_config(args, constructor, trace_patch, layout_patch):
17921803 trace_patch ["opacity" ] = args ["opacity" ]
17931804 else :
17941805 trace_patch ["marker" ] = dict (opacity = args ["opacity" ])
1795- if "line_group" in args : # px.line, px.line_*, px.area
1806+ if (
1807+ "line_group" in args or "line_dash" in args
1808+ ): # px.line, px.line_*, px.area, px.ecdf, px, kde
17961809 modes = set (["lines" ])
17971810 if args .get ("text" ) or args .get ("symbol" ) or args .get ("markers" ):
17981811 modes .add ("markers" )
@@ -2055,7 +2068,17 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
20552068 base = args ["x" ] if args ["orientation" ] == "v" else args ["y" ]
20562069 var = args ["x" ] if args ["orientation" ] == "h" else args ["y" ]
20572070 group = group .sort_values (by = base )
2071+ group_sum = group [var ].sum ()
20582072 group [var ] = group [var ].cumsum ()
2073+ if args ["complementary" ]:
2074+ group [var ] = group_sum - group [var ]
2075+
2076+ if args ["norm" ] == "probability" :
2077+ group [var ] = group [var ] / group_sum
2078+ elif args ["norm" ] == "percent" :
2079+ group [var ] = 100.0 * group [var ] / group_sum
2080+ args ["histnorm" ] = args ["norm" ]
2081+ # TODO norm, including histnorm-like naming
20592082
20602083 patch , fit_results = make_trace_kwargs (
20612084 args , trace_spec , group , mapping_labels .copy (), sizeref
0 commit comments