I have a surface I want to display with plotly (it has to be a surface and not a 3D mesh because a 3D mesh is not appropiate so I must pass on a matrix not a data.frame).
For this I want to control the hoverinfo so it won't display the x, y, z coordinated but it does display x * y = ... and x + y = .... However I am encountering a problem with the hovertext argument. Which correctly displays the things I want but also displays the x, y, z coordinates. Also, I can't get "<extra></extra>" to work.
This is attempt so far:
library(plotly)
mat <- 0:10 %*% t(0:10)
plot_ly() |>
add_surface(z = ~mat,
hovertext = paste(
"X*Y:", mat,
"<br>X+Y: ", rep(0:10, each = 11) + rep(0:10, 11),
"<extra></extra>") |>
matrix(ncol = 11),
hovertemplate = text)
I would like to know:
- How can I remove the
x, y, zcoordinates from thehovertemplate? - How can I use
"<extra></extra>"argument when usinghovertemplate = text?
EDIT: Following @Kat's comment I edited this post to reflect what I learned. Thanks Kat!
Thank you for your help!