Skip to content

Commit 94303bc

Browse files
v_label -> attr_label
1 parent e7ced12 commit 94303bc

File tree

1 file changed

+15
-13
lines changed
  • packages/python/plotly/plotly/express

1 file changed

+15
-13
lines changed

packages/python/plotly/plotly/express/_core.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
169169
custom_data_len = 0
170170
for attr_name in trace_spec.attrs:
171171
attr_value = args[attr_name]
172-
v_label = get_decorated_label(args, attr_value, attr_name)
172+
attr_label = get_decorated_label(args, attr_value, attr_name)
173173
if attr_name == "dimensions":
174174
dims = [
175175
(name, column)
@@ -210,7 +210,7 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
210210
result["marker"]["size"] = trace_data[attr_value]
211211
result["marker"]["sizemode"] = "area"
212212
result["marker"]["sizeref"] = sizeref
213-
mapping_labels[v_label] = "%{marker.size}"
213+
mapping_labels[attr_label] = "%{marker.size}"
214214
elif attr_name == "marginal_x":
215215
if trace_spec.constructor == go.Histogram:
216216
mapping_labels["count"] = "%{y}"
@@ -294,13 +294,15 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
294294
)
295295
else:
296296
result["customdata"] = trace_data[col].values[:, None]
297-
v_label_col = get_decorated_label(args, col, None)
298-
mapping_labels[v_label_col] = "%%{customdata[%d]}" % (position)
297+
attr_label_col = get_decorated_label(args, col, None)
298+
mapping_labels[attr_label_col] = "%%{customdata[%d]}" % (
299+
position
300+
)
299301
elif attr_name == "color":
300302
if trace_spec.constructor in [go.Choropleth, go.Choroplethmapbox]:
301303
result["z"] = trace_data[attr_value]
302304
result["coloraxis"] = "coloraxis1"
303-
mapping_labels[v_label] = "%{z}"
305+
mapping_labels[attr_label] = "%{z}"
304306
elif trace_spec.constructor in [
305307
go.Sunburst,
306308
go.Treemap,
@@ -313,7 +315,7 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
313315
if args.get("color_is_continuous"):
314316
result["marker"]["colors"] = trace_data[attr_value]
315317
result["marker"]["coloraxis"] = "coloraxis1"
316-
mapping_labels[v_label] = "%{color}"
318+
mapping_labels[attr_label] = "%{color}"
317319
else:
318320
result["marker"]["colors"] = []
319321
mapping = {}
@@ -331,23 +333,23 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
331333
result[colorable] = dict()
332334
result[colorable]["color"] = trace_data[attr_value]
333335
result[colorable]["coloraxis"] = "coloraxis1"
334-
mapping_labels[v_label] = "%%{%s.color}" % colorable
336+
mapping_labels[attr_label] = "%%{%s.color}" % colorable
335337
elif attr_name == "animation_group":
336338
result["ids"] = trace_data[attr_value]
337339
elif attr_name == "locations":
338340
result[attr_name] = trace_data[attr_value]
339-
mapping_labels[v_label] = "%{location}"
341+
mapping_labels[attr_label] = "%{location}"
340342
elif attr_name == "values":
341343
result[attr_name] = trace_data[attr_value]
342-
_label = "value" if v_label == "values" else v_label
344+
_label = "value" if attr_label == "values" else attr_label
343345
mapping_labels[_label] = "%{value}"
344346
elif attr_name == "parents":
345347
result[attr_name] = trace_data[attr_value]
346-
_label = "parent" if v_label == "parents" else v_label
348+
_label = "parent" if attr_label == "parents" else attr_label
347349
mapping_labels[_label] = "%{parent}"
348350
elif attr_name == "ids":
349351
result[attr_name] = trace_data[attr_value]
350-
_label = "id" if v_label == "ids" else v_label
352+
_label = "id" if attr_label == "ids" else attr_label
351353
mapping_labels[_label] = "%{id}"
352354
elif attr_name == "names":
353355
if trace_spec.constructor in [
@@ -357,14 +359,14 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
357359
go.Funnelarea,
358360
]:
359361
result["labels"] = trace_data[attr_value]
360-
_label = "label" if v_label == "names" else v_label
362+
_label = "label" if attr_label == "names" else attr_label
361363
mapping_labels[_label] = "%{label}"
362364
else:
363365
result[attr_name] = trace_data[attr_value]
364366
else:
365367
if attr_value:
366368
result[attr_name] = trace_data[attr_value]
367-
mapping_labels[v_label] = "%%{%s}" % attr_name
369+
mapping_labels[attr_label] = "%%{%s}" % attr_name
368370
if trace_spec.constructor not in [
369371
go.Parcoords,
370372
go.Parcats,

0 commit comments

Comments
 (0)