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

Function make_mapping

plotly/express/_core.py:252–299  ·  view source on GitHub ↗
(args, variable)

Source from the content-addressed store, hash-verified

250
251
252def make_mapping(args, variable):
253 if variable == "line_group" or variable == "animation_frame":
254 return Mapping(
255 show_in_trace_name=False,
256 grouper=args[variable],
257 val_map={},
258 sequence=[""],
259 variable=variable,
260 updater=(lambda trace, v: v),
261 facet=None,
262 )
263 if variable == "facet_row" or variable == "facet_col":
264 letter = "x" if variable == "facet_col" else "y"
265 return Mapping(
266 show_in_trace_name=False,
267 variable=letter,
268 grouper=args[variable],
269 val_map={},
270 sequence=[i for i in range(1, 1000)],
271 updater=(lambda trace, v: v),
272 facet="row" if variable == "facet_row" else "col",
273 )
274 (parent, variable, *other_variables) = variable.split(".")
275 vprefix = variable
276 arg_name = variable
277 if variable == "color":
278 vprefix = "color_discrete"
279 if variable == "dash":
280 arg_name = "line_dash"
281 vprefix = "line_dash"
282 if variable in ["pattern", "shape"]:
283 arg_name = "pattern_shape"
284 vprefix = "pattern_shape"
285 if args[vprefix + "_map"] == "identity":
286 val_map = IdentityMap()
287 else:
288 val_map = args[vprefix + "_map"].copy()
289 return Mapping(
290 show_in_trace_name=True,
291 variable=variable,
292 grouper=args[arg_name],
293 val_map=val_map,
294 sequence=args[vprefix + "_sequence"],
295 updater=lambda trace, v: trace.update(
296 {parent: {".".join([variable] + other_variables): v}}
297 ),
298 facet=None,
299 )
300
301
302def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):

Callers 1

infer_configFunction · 0.85

Calls 4

IdentityMapClass · 0.85
splitMethod · 0.45
copyMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected