Is it possible to pass functions in a hover template?

Hi I am struggling to find a way to display the x-axis value of hoverinfo as a vector.

I encountered this problem while plotting the following surface:

                hovertemplate='''Average x-value: %{x}
                <br>y-value: %{y}<br>z-value: %{z}''',

Here x.shape = (20, 2), y.shape=(30,), z.shape= (20, 30), for instance.

To plot the graph I simply used the average value of x_axis, but for hovering, I want to display the original data, namely the 1x2- vector. Now I was wondering if instead of passing x-value %{x} in the hover template, can we pass something like the %{x*2} in the hover template?

I have tried things like %{float(x) **2} and the format above, but both displayed as undefined.

Any way to work on this?

P.S. As my real example involves a large amount of data, I’d say by directly annotating text as an array of strings is not an ideal option. In my test with some 200 x 500 z-value the hovertext already kinda laggy in displaying…