Skip to content

Commit 23ef3b8

Browse files
committed
addressed review comments
1 parent 8ed1ecc commit 23ef3b8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
77
### Fixed
88

99
- Fixed special cases with `px.sunburst` and `px.treemap` with `path` input ([#2524](https://github.com/plotly/plotly.py/pull/2524))
10+
- Fixed bug in `hover_data` argument of `px` functions, when the column name is changed with labels and `hover_data` is a dictionary setting up a specific format for the hover data ([#2544](https://github.com/plotly/plotly.py/pull/2544)).
1011

1112
## [4.8.1] - 2020-05-28
1213

Diff for: packages/python/plotly/plotly/express/_core.py

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ def get_label(args, column):
117117

118118

119119
def invert_label(args, column):
120+
"""Invert mapping.
121+
Find key corresponding to value column in dict args["labels"].
122+
Returns `column` if the value does not exist.
123+
"""
120124
reversed_labels = {value: key for (key, value) in args["labels"].items()}
121125
try:
122126
return reversed_labels[column]
@@ -442,6 +446,7 @@ def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
442446
mapping_labels_copy = OrderedDict(mapping_labels)
443447
if args["hover_data"] and isinstance(args["hover_data"], dict):
444448
for k, v in mapping_labels.items():
449+
# We need to invert the mapping here
445450
k_args = invert_label(args, k)
446451
if k_args in args["hover_data"]:
447452
if args["hover_data"][k_args][0]:

0 commit comments

Comments
 (0)