How to controll hovertemplate when using `text` as argument

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 my 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, z coordinates from the hovertemplate?
  • How can I use the "<extra></extra>" option when using hovertemplate = text?

Thank you for your help!