Skip to content

Unify hovertemplate title cannot be edited. #4494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
FabioMosella opened this issue Jan 24, 2024 · 1 comment
Open

Unify hovertemplate title cannot be edited. #4494

FabioMosella opened this issue Jan 24, 2024 · 1 comment
Labels
bug something broken P3 backlog sev-3 annoyance with workaround

Comments

@FabioMosella
Copy link

Hello

It seems that we cannot modify the title of the hovertemplate when the chart uses a unify hovermode whenever the axis has not a date type.

Here a short example with 2 scatter plots, the first one with a date axis and the second is linear:

import numpy as np
import pandas as pd
from plotly.subplots import make_subplots

dates = pd.date_range("2022-01-01", "2022-03-01")
values = np.random.randint(0, 10, len(dates))

fig = make_subplots(cols=2) 
fig.add_scatter(x=dates, y=values, row=1, col=1)
fig.add_scatter(x=values, y=values, mode="markers", row=1, col=2)

fig.update_traces(hovertemplate="%{y}<extra></extra>")
fig.update_xaxes(row=1, col=1, hoverformat=" ")
fig.update_xaxes(row=1, col=2, type="linear", hoverformat=" ")
fig.update_layout(hovermode="x unified")

fig.show()

image

If you force the second scatter to be a date type, the hovertemplate title is removed with the workaround hoverformat=" ". However, it only works for date axis.

Here some references/related issues:
#4278
https://community.plotly.com/t/customizing-text-on-x-unified-hovering/39440/18
https://community.plotly.com/t/pass-nothing-or-disable-x-axis-hoverformat/67496

plotly version = 5.18.0

@Coding-with-Adam
Copy link
Contributor

hi @FabioMosella
Thank you for reporting this bug. I was able able to reproduce the error locally.

@Coding-with-Adam Coding-with-Adam added bug something broken sev-3 annoyance with workaround labels Jan 29, 2024
@gvwilson gvwilson self-assigned this Jul 11, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog sev-3 annoyance with workaround
Projects
None yet
Development

No branches or pull requests

3 participants