@@ -1438,11 +1438,7 @@ def build_dataframe(args, constructor):
1438
1438
1439
1439
if hist1d_orientation :
1440
1440
args ["x" if orient_v else "y" ] = value_name
1441
- if wide_cross_name is None and constructor == go .Scatter :
1442
- args ["y" if orient_v else "x" ] = count_name
1443
- df_output [count_name ] = 1
1444
- else :
1445
- args ["y" if orient_v else "x" ] = wide_cross_name
1441
+ args ["y" if orient_v else "x" ] = wide_cross_name
1446
1442
args ["color" ] = args ["color" ] or var_name
1447
1443
elif constructor in [go .Scatter , go .Funnel ] + hist2d_types :
1448
1444
args ["x" if orient_v else "y" ] = wide_cross_name
@@ -1464,6 +1460,21 @@ def build_dataframe(args, constructor):
1464
1460
elif constructor in [go .Violin , go .Box ]:
1465
1461
args ["x" if orient_v else "y" ] = wide_cross_name or var_name
1466
1462
args ["y" if orient_v else "x" ] = value_name
1463
+
1464
+ if hist1d_orientation and constructor == go .Scatter :
1465
+ if args ["x" ] is not None and args ["y" ] is not None :
1466
+ args ["histfunc" ] = "sum"
1467
+ elif args ["x" ] is None :
1468
+ args ["histfunc" ] = None
1469
+ args ["orientation" ] = "h"
1470
+ args ["x" ] = count_name
1471
+ df_output [count_name ] = 1
1472
+ else :
1473
+ args ["histfunc" ] = None
1474
+ args ["orientation" ] = "v"
1475
+ args ["y" ] = count_name
1476
+ df_output [count_name ] = 1
1477
+
1467
1478
if no_color :
1468
1479
args ["color" ] = None
1469
1480
args ["data_frame" ] = df_output
@@ -1760,8 +1771,10 @@ def infer_config(args, constructor, trace_patch, layout_patch):
1760
1771
trace_patch ["opacity" ] = args ["opacity" ]
1761
1772
else :
1762
1773
trace_patch ["marker" ] = dict (opacity = args ["opacity" ])
1763
- if "line_group" in args :
1764
- trace_patch ["mode" ] = "lines" + ("+markers+text" if args ["text" ] else "" )
1774
+ if "line_group" in args or "line_dash" in args :
1775
+ trace_patch ["mode" ] = "lines" + (
1776
+ "+markers+text" if args .get ("text" , None ) is not None else ""
1777
+ )
1765
1778
elif constructor != go .Splom and (
1766
1779
"symbol" in args or constructor == go .Scattermapbox
1767
1780
):
@@ -2018,7 +2031,17 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
2018
2031
base = args ["x" ] if args ["orientation" ] == "v" else args ["y" ]
2019
2032
var = args ["x" ] if args ["orientation" ] == "h" else args ["y" ]
2020
2033
group = group .sort_values (by = base )
2034
+ group_sum = group [var ].sum ()
2021
2035
group [var ] = group [var ].cumsum ()
2036
+ if args ["complementary" ]:
2037
+ group [var ] = group_sum - group [var ]
2038
+
2039
+ if args ["norm" ] == "probability" :
2040
+ group [var ] = group [var ] / group_sum
2041
+ elif args ["norm" ] == "percent" :
2042
+ group [var ] = 100.0 * group [var ] / group_sum
2043
+ args ["histnorm" ] = args ["norm" ]
2044
+ # TODO norm, including histnorm-like naming
2022
2045
2023
2046
patch , fit_results = make_trace_kwargs (
2024
2047
args , trace_spec , group , mapping_labels .copy (), sizeref
0 commit comments