✊🏿 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!

Customizing text on x unified hovering

I’m using “x unified” hovermode on a plot where the x-axis variable is a date. I’d like to be able to customize the date format that appears when you hover over the plot (e.g. display the day of the week). I can do this pretty easily using hovertemplate for the text that appears next to each trace (there are multiple lines on the plot) but I can’t figure out how to customize the date format for the x unified date that appears at the top of the pop-up. Any suggestions?

1 Like

Perhaps in your case it would suffice to format the xvalues before you start plotting anything.

I have a similar problem, only that I would like to change the title of the hoverlabel completely (i.e. use ticklabels instead of x = tickvalues, which are used as a default)

There seems to be no attribute with which you can set/modify the title directly in the figure object.
Can anyone help?

You can use layout.xaxis.hoverformat :slight_smile:

Hi Nicolas,
I currently have a similar issue as discussed above. I would like to have a plot in hovermode “x unified” with a customized title of the hover label. The title of the hover label is by default set to the x-axis value. On the x-axis, I want to show only ever second x-tick and customize the x-ticklabels. I use tickvals and ticktext to achieve that. Here is the problem: When I do that, the title of the hover label is set to the value in ticktext if the corresponding tickval exists or to the original x-axis value if the corresponding tickval does not exist. I would like the hover label title to always follow the ticktext format. How can this be achieved?

1 Like

I currently have a similar issue as discussed above. I would like to have a plot in hovermode “x unified” with a customized title of the hover label. The title of the hover label is by default set to the x-axis value. On the x-axis, I want to show only ever second x-tick and customize the x-ticklabels. I use tickvals and ticktext to achieve that. Here is the problem: When I do that, the title of the hover label is set to the value in ticktext if the corresponding tickval exists or to the original x-axis value if the corresponding tickval does not exist. I would like the hover label title to always follow the ticktext format. How can this be achieved?

I"m not really following the desire here… can you provide a concrete example with a screenshot or something please?

Hi I have a similar need, i.e. to customize the title of the hover box in the “x unified” hover mode.
I am visualizinf a dataframe with some numerical data and some categorical data.
Each trace is a line relevant to a numerical column
x is a timeline in seconds.
when hovering over second x I’d like to see in the title of the hover box the number of the second plus the value of
some categorical columns relevant to the same dataframe row as second x.