How do I prevent the text values passed as text=df.petal_width.values
in the example below from showing up in the hover tooltip? They should only display as annotations directly on the plot.
import plotly.express as px
df = px.data.iris()
fig = px.scatter(
df,
x="sepal_length",
y="sepal_width",
color="species",
text=df.petal_width.values,
)
fig.show()
To be clear, I know I could pass text=df.petal_width
and the tooltip value would not be called text
but petal_width
. This is not what I want. I want it gone entirely. Only way I found so far is ugly:
hov_temp = [
x for x in fig.data[0].hovertemplate.split("<br>") if not x.startswith("text")
]
fig.data[0].hovertemplate = "<br>".join(hov_temp)