I was wondering if there was any way to disable the default tooltip information when applying a hovertemplate.
I get that there is an easy way of doing so by using hoverinfo=..., but later on putting a hovertemplate through update_traces() cancels this effect.
Would there be a way to have the tooltip stop displaying the trace the cursor is on, or, in a violinplot, the max, upper and lower fence etc. while using a hovertemplate ?
I have seen the subject covered in JavaScript, but the trick there doesnโt seem to be transposable to Python.
hovertemplate will override hoverinfo attribute, it means that even if you set the hoverinfo as โnoneโ or โskipโ it will show the tooltip until you set hovertemplate attribute with empty string or None.
Thank you for your answer!
I do want to display the tooltip, but I want to control what data is displayed.
The hovertemplate allows me to add custom information on the hover, but also comes with some default information I do not want to be displayed. It might be more explicit in the following pictures:
On these two pictures, the name of the trace the information is extracted from is shown on the right-hand side of the hover. I did not explicitly specify to do so in my knowledge. Would you know how to get rid of these?
I just found how to do so in the link you sent. Thank you very much!
One simply has to enter <extra></extra> at the end of the string given to the hovertemplate. As it is said in the documentation:
Anything contained in tag <extra> is displayed in the secondary box. [โฆ] To hide the secondary box completely, use an empty tag <extra></extra>.
So in my first example, it can be removed with: hovertemplate = "Sample %{customdata[0]} <extra></extra>".