Customize Hoverinfo of a Heatmap


I am trying to implement a correlation heatmap app. Instead of the hovertext ‘x’, ‘y’, ‘z’ with corresponding values I want to have ‘A’,‘B’,‘Correlation’.

This has been posted already some months ago: How to customize Hoverinfo of a Heatmap?

However, I do not know how to implement this in R.