✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Tooltip in Dash shows "trace 0", how to get rid of that?

Hello,

I have a hover tool tip for a go.Choroplethmapbox. The left side shows what I added using

hovertemplate = '''
<b>%{customdata}</b>
<br>%{z}<br>
'''

but the right side says “trace 0”. Any idea how to get rid of that?

Hi @solarjoe, you need to add <extra></extra> at the end of the hovertemplate, as in https://plotly.com/python/hover-text-and-formatting/#customize-tooltip-text-with-a-hovertemplate. The <extra> tag is for the second part of the hover, in a different color, where usually the trace name is displayed.

Yes, that’s it, thanks. I could not find anything in the docs about it. But there is a sentence about it in the plotly.js code:

'Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>".',
'To hide the secondary box completely, use an empty tag `<extra></extra>`.'

Actually I submitted a pull request to the documentation just after reading your question https://github.com/plotly/plotly.py/pull/2329 :slight_smile:

Ok, you win :slight_smile:

… 20 character fill …

1 Like