@@ -154,7 +154,7 @@ def get_decorated_label(args, column, role):
154154 or (role == "y" and "orientation" in args and args ["orientation" ] == "v" )
155155 ):
156156 histfunc = args ["histfunc" ] or "count"
157- if label and histfunc != "count" :
157+ if histfunc != "count" :
158158 label = "%s of %s" % (histfunc , label )
159159 else :
160160 label = "count"
@@ -163,7 +163,10 @@ def get_decorated_label(args, column, role):
163163 if label == "count" :
164164 label = args ["histnorm" ]
165165 else :
166- label = "%s of %s" % (args ["histnorm" ], label )
166+ histnorm = args ["histnorm" ]
167+ # avoid "probability of sum of thing"
168+ histnorm = "fraction" if histnorm == "probability" else histnorm
169+ label = "%s of %s" % (histnorm , label )
167170
168171 if "barnorm" in args and args ["barnorm" ] is not None :
169172 label = "%s (normalized as %s)" % (label , args ["barnorm" ])
@@ -1800,6 +1803,14 @@ def infer_config(args, constructor, trace_patch, layout_patch):
18001803 ):
18011804 args ["facet_col_wrap" ] = 0
18021805
1806+ if "norm" in args :
1807+ if args .get ("norm" , None ) not in [None , "percent" , "probability" ]:
1808+ raise ValueError (
1809+ "`norm` must be one of None, 'percent' or 'probability'. "
1810+ + "'%s' was provided." % args ["norm" ]
1811+ )
1812+ args ["histnorm" ] = args ["norm" ]
1813+
18031814 # Compute applicable grouping attributes
18041815 for k in group_attrables :
18051816 if k in args :
@@ -2027,8 +2038,6 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
20272038 group [var ] = group [var ] / group_sum
20282039 elif args ["norm" ] == "percent" :
20292040 group [var ] = 100.0 * group [var ] / group_sum
2030- args ["histnorm" ] = args ["norm" ]
2031- # TODO norm, including histnorm-like naming
20322041
20332042 patch , fit_results = make_trace_kwargs (
20342043 args , trace_spec , group , mapping_labels .copy (), sizeref
0 commit comments