Customdata in texttemplate could not be found in heatmap
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
For a heatmap chart I want to create a hyperlink, which is provided in the customdata. For some reason it looks like the customdata fields is not accessible from the texttemplate field. Executing the sample code below with browser debug mode shows that customdata is not found:
import plotly.graph_objects as go
labels = ["a", "b", "c"]
z = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
customdata = [["http://google.com", "http://google.com", "http://google.com"], ["http://google.com", "http://google.com", "http://google.com"], ["http://google.com", "http://google.com", "http://google.com"]]
fig = go.Figure(data=go.Heatmap(x=labels, y=labels,
z=z,
customdata=customdata,
texttemplate="""<a href="%{customdata}">%{z}</a>""",
hovertemplate='%{customdata}<extra></extra>',
textfont={"size": 20}))
fig.show()
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Python heatmap example and trace how Heatmap customdata is passed to texttemplate, comparing it with the working hovertemplate behavior. Confirm the fix by rendering the hyperlink with the customdata URL and checking that the existing hover text still displays correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- plotly, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100