MCPcopy Index your code
hub / github.com/plotly/plotly.py / get_decorated_label

Function get_decorated_label

plotly/express/_core.py:214–249  ·  view source on GitHub ↗
(args, column, role)

Source from the content-addressed store, hash-verified

212
213
214def get_decorated_label(args, column, role):
215 original_label = label = get_label(args, column)
216 if "histfunc" in args and (
217 (role == "z")
218 or (role == "x" and "orientation" in args and args["orientation"] == "h")
219 or (role == "y" and "orientation" in args and args["orientation"] == "v")
220 ):
221 histfunc = args["histfunc"] or "count"
222 if histfunc != "count":
223 label = "%s of %s" % (histfunc, label)
224 else:
225 label = "count"
226
227 if "histnorm" in args and args["histnorm"] is not None:
228 if label == "count":
229 label = args["histnorm"]
230 else:
231 histnorm = args["histnorm"]
232 if histfunc == "sum":
233 if histnorm == "probability":
234 label = "%s of %s" % ("fraction", label)
235 elif histnorm == "percent":
236 label = "%s of %s" % (histnorm, label)
237 else:
238 label = "%s weighted by %s" % (histnorm, original_label)
239 elif histnorm == "probability":
240 label = "%s of sum of %s" % ("fraction", label)
241 elif histnorm == "percent":
242 label = "%s of sum of %s" % ("percent", label)
243 else:
244 label = "%s of %s" % (histnorm, label)
245
246 if "barnorm" in args and args["barnorm"] is not None:
247 label = "%s (normalized as %s)" % (label, args["barnorm"])
248
249 return label
250
251
252def make_mapping(args, variable):

Callers 4

make_trace_kwargsFunction · 0.85
configure_cartesian_axesFunction · 0.85
make_figureFunction · 0.85

Calls 1

get_labelFunction · 0.85

Tested by

no test coverage detected