You could use the type='heatmap' with add_annotations to add the y variable. Make sure showarrow = FALSE like this:

library(plotly)
library(dplyr)

TestData1 %>%
  plot_ly(x = ~Countries, y = ~variable, z = ~value, type = "heatmap", colors = c("#56B1F7", "#132B43")) %>%
  add_annotations(text = ~value, x = ~Countries, y = ~variable, showarrow = FALSE, font = list(color = "white")) %>%
  layout(xaxis = list(side = "top"), 
         yaxis = list(title = ""), 
         showlegend = FALSE) %>%
  hide_colorbar()

Created on 2023-03-17 with reprex v2.0.2

Answer from Quinten on Stack Overflow
๐ŸŒ
Plotly
plotly.com โ€บ r โ€บ heatmaps
Heatmaps in R
Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here. library(plotly) fig <- plot_ly(z = volcano, type = "heatmap") fig
๐ŸŒ
R Graph Gallery
r-graph-gallery.com โ€บ 215-interactive-heatmap-with-plotly.html
Plotly heatmap โ€“ the R Graph Gallery
# Load the plotly package library(plotly) # Data: mtcars: data <- as.matrix(mtcars) # Normalize data data <- apply(data, 2, function(x){x/mean(x)}) # Heatmap p <- plot_ly(x=colnames(data), y=rownames(data), z = data, type = "heatmap", colorscale= "Earth", showscale = F) %>% layout(margin = list(l=120)) p # save the widget # library(htmlwidgets) # saveWidget(p, file=paste0( getwd(), "/HtmlWidget/plotlyHeatmap2.html"))
๐ŸŒ
Plotly
plotly.com โ€บ r โ€บ reference โ€บ heatmap
R Figure Reference: heatmap Traces
Then, by default, the resulting heatmap will have N partitions along the y axis and M partitions along the x axis. In other words, the i-th row/ j-th column cell in `z` is mapped to the i-th partition of the y axis (starting from the bottom of the plot) and the j-th partition of the x-axis (starting from the left of the plot).
๐ŸŒ
Statistics Globe
statisticsglobe.com โ€บ home โ€บ learn r programming (tutorial & examples) | free introduction โ€บ create heatmap in r (3 examples) | base r, ggplot2 & plotly package
Create Heatmap in R (3 Examples) | Base R, ggplot2 & plotly Package
May 12, 2025 - As you can see based on Figure 7, the Greys specification created a heatmap in greyscale. Note that the plotly package show its graphics in the RStudio viewer instead of the RStudio plot window.
๐ŸŒ
R Graph Gallery
r-graph-gallery.com โ€บ heatmap
Heatmap | the R Graph Gallery
Three options exist to build an interactive heatmap from R: plotly: as described above, plotly allows to turn any heatmap made with ggplot2 interactive. d3heatmap: a package that uses the same syntax as the base R heatmap() function to make ...
๐ŸŒ
GitHub
github.com โ€บ talgalili โ€บ heatmaply
GitHub - talgalili/heatmaply: Interactive Heat Maps for R Using plotly ยท GitHub
Interactive heatmaps allow the inspection of specific value by hovering the mouse over a cell, as well as zooming into a region of the heatmap by dragging a rectangle around the relevant area. This work is based on the ggplot2 and plotly.js engine.
Starred by 406 users
Forked by 75 users
Languages: R 99.8% | Makefile 0.2%
๐ŸŒ
Plotly
plotly.com โ€บ ggplot2 โ€บ heatmaps
Heatmaps in ggplot2
How to make Heatmaps plots in ggplot2 with Plotly. Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now. Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.
Find elsewhere
๐ŸŒ
ProjectPro
projectpro.io โ€บ recipes โ€บ plot-heatmaps-plotly-r
How to plot heatmaps using plotly in R -
July 23, 2021 - Heat maps are plots that represent the data points in the form of a map, where the data points are shown with varying colors. Heat maps are widely used for visualizing complex statistical data. This recipe demonstrates an example on heatmaps in R.
๐ŸŒ
CRAN
cran.r-project.org โ€บ package=heatmaply
heatmaply: Interactive Cluster Heat Maps Using 'plotly' and 'ggplot2'
July 12, 2025 - This work is based on the 'ggplot2' and 'plotly.js' engine. It produces similar 'heatmaps' to 'heatmap.2' with the advantage of speed ('plotly.js' is able to handle larger size matrix), the ability to zoom from the 'dendrogram' panes, and the ...
๐ŸŒ
Plotly
plotly.com โ€บ r โ€บ heatmap-webgl
Webgl heatmaps in R
Detailed examples of WebGL Heatmaps including changing color, size, log axes, and more in R.
๐ŸŒ
Plotly
community.plotly.com โ€บ plotly r, matlab, julia, net
Help with a Heatmap Graph - Plotly R, MATLAB, Julia, Net - Plotly Community Forum
November 19, 2022 - Can someone help me with graph like the one attached ? Any pointers that I can use to create this kind of graph. My data is each row in the graph is a column in the dataframe with its own category. I would like to create something like the attached and also create a legend for each category.
๐ŸŒ
Datanovia
datanovia.com โ€บ learn โ€บ machine learning โ€บ clustering heatmaps in r: heatmap, pheatmap & more
Clustering Heatmaps in R: heatmap, pheatmap & More โ€“ Datanovia
Use heatmaply() from the heatmaply package: heatmaply(scale(mydata), k_row = 4, k_col = 2). It renders through plotly, so you can hover over any cell to read its value and zoom into regions.
๐ŸŒ
Talgalili
talgalili.github.io โ€บ heatmaply
Interactive Cluster Heat Maps Using plotly and ggplot2 โ€ข heatmaply
Create interactive cluster heatmaps ... details or drag a rectangle to zoom. A heatmap is a popular graphical method for visualizing high-dimensional data, in which a table of numbers are encoded as a grid of colored cells....
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ plotly โ€บ plotly_heatmap.htm
Plotly - Heatmap
Heat Maps are innately self-explanatory. The darker the shade, the greater the quantity (the higher the value, the tighter the dispersion, etc.). Plotlys graph_objects module contains Heatmap() function.
๐ŸŒ
CRAN
cran.r-project.org โ€บ web โ€บ packages โ€บ heatmaply โ€บ vignettes โ€บ heatmaply.html
Introduction to heatmaply - CRAN
heatmaply also provides an interface based around the plotly R package. This interface can be used by choosing plot_method = "plotly" instead of the default plot_method = "ggplot".
๐ŸŒ
R-universe
talgalili.r-universe.dev โ€บ heatmaply
heatmaply: Interactive Cluster Heat Maps Using 'plotly' and 'ggplot2'
'Heatmaps' are used in many fields ... and more. Interactive 'heatmaps' allow the inspection of specific value by hovering the mouse over a cell, as well as zooming into a region of the 'heatmap' by dragging a rectangle around the relevant area. This work is based on the 'ggplot2' ...
๐ŸŒ
Plotly
plotly.com โ€บ chart-studio-help โ€บ make-a-heatmap
Heatmaps
After adding data, go to the 'Traces' section under the 'Structure' menu on the left-hand side. Choose the 'Type' of trace, then choose 'Heatmap' under 'Simple' chart type. Next, select 'X' and 'Y', and fill out the 'Z' values from their respective ...
๐ŸŒ
Zikai Lin
zikai.page โ€บ heatmap_plotly2
R-Blog: Heatmap using R Plotly - Zikai Lin
February 1, 2021 - But a reverse scale, which is Blue-Red colorscheme are more often used, so you might want to specify reversescale = TRUE ยท library(plotly) fig <- plot_ly(z = volcano, type = "heatmap", colors = "RdBu", reversescale =T) fig
๐ŸŒ
Plotly
plotly.com โ€บ python โ€บ heatmaps
Heatmaps in Python
Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now. The term "heatmap" usually refers to a Cartesian plot with data visualized as colored rectangular tiles, which is the subject ...