# Change 'x', 'y' to something else in hover tooltip using heatmapI

**URL:** <https://community.plotly.com/t/change-x-y-to-something-else-in-hover-tooltip-using-heatmapi/473>\
**Category:** Plotly Fundamentals\
**Created:** [February 4, 2016, 10:50pm UTC](https://community.plotly.com/t/change-x-y-to-something-else-in-hover-tooltip-using-heatmapi/473 "2016-02-04T22:50:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![geekraver](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/geekraver/32/117_2.png) [@geekraver](https://community.plotly.com/u/geekraver)\
**Post date:** [February 4, 2016, 10:50pm UTC](https://community.plotly.com/t/change-x-y-to-something-else-in-hover-tooltip-using-heatmapi/473/1 "2016-02-04T22:50:23Z")

</div>

I have a heatmap, and have given the x and y axes titles (‘actual’, ‘predicted’). But when I hover on the heatmap I still see ‘x’ and ‘y’ labels with the values. Is there a way to get them to change here too?

---

<div class="post-metadata">

**Author:** ![empet](https://avatars.discourse-cdn.com/v4/letter/e/977dab/32.png) [@empet](https://community.plotly.com/u/empet)\
**Post date:** [February 5, 2016, 7:54am UTC](https://community.plotly.com/t/change-x-y-to-something-else-in-hover-tooltip-using-heatmapi/473/2 "2016-02-05T07:54:33Z")

</div>

If your data for plotting the heatmap are X, Y, Z,  
then you define the text to be displayed at hovering the mouse over your plot  
as follows:

```auto
text=[['(actual, predicted)=('+'{:.2f}'.format(X[i])+', '+'{:.2f}'.format(Y[j])+')' for i in range(len(X)) ] 
       for j in range(len(Y))]

```

and the Heatmap object as:

```auto
trace=Heatmap( z=Z, x=X, y=Y, colorscale='your_colorscale', 
               text=text, hoverinfo='text')

```

---

<div class="post-metadata">

**Author:** ![lincoln](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@lincoln](https://community.plotly.com/u/lincoln)\
**Post date:** [June 29, 2016, 5:47am UTC](https://community.plotly.com/t/change-x-y-to-something-else-in-hover-tooltip-using-heatmapi/473/3 "2016-06-29T05:47:06Z")

</div>

I try your suggest , but ‘test’ show Error information as " Error: unexpected ‘[[’ in “text=[[”"spaces`

m \<- matrix(rnorm(9), nrow = 3, ncol = 3)  
text=[[’(actual, predicted)=(’+’{:.2f}’.format(X[i])+’, ‘+’{:.2f}’.format(Y[j])+’)’ for i in range(len(X)) ]  
for j in range(len(Y))]  
p \<- plot\_ly(z = m,  
x = c(“a”, “b”, “c”), y = c(“d”, “e”, “f”),  
type = “heatmap”)  
layout(p, xaxis=list(title = “year”), yaxis=list(title=‘grp’),margin=list(l=150))
