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 OverflowPlotly
plotly.com โบ r โบ heatmaps
Heatmaps in R
vals <- unique(scales::rescale(c(volcano))) o <- order(vals, decreasing = FALSE) cols <- scales::col_numeric("Blues", domain = NULL)(vals) colz <- setNames(data.frame(vals[o], cols[o]), NULL) fig <- plot_ly(z = volcano, colorscale = colz, type = "heatmap") fig
How do I make a heatmap in R?
Pass a numeric matrix to a heatmap function. The base one-liner is heatmap(scale(mydata)); for a prettier, annotated version use pheatmap(scale(mydata), cutree_rows = 4). Always scale() the matrix first so one large-magnitude variable doesnโt dominate the colors. Both functions cluster and reorder the rows and columns automatically.
datanovia.com
datanovia.com โบ learn โบ machine learning โบ clustering heatmaps in r: heatmap, pheatmap & more
Clustering Heatmaps in R: heatmap, pheatmap & More โ Datanovia
How do I make an interactive heatmap in R?
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. It accepts the same clustering arguments as a static heatmap.
datanovia.com
datanovia.com โบ learn โบ machine learning โบ clustering heatmaps in r: heatmap, pheatmap & more
Clustering Heatmaps in R: heatmap, pheatmap & More โ Datanovia
What is the difference between pheatmap and heatmap?
Base heatmap() ships with R and needs no install, but its styling is plain and annotating it is fiddly (you build color side-bars by hand). pheatmap() (โpretty heatmapโ) gives cleaner defaults, draws nicer dendrograms, cuts the tree into groups with cutree_rows, and annotates rows and columns directly from a data frame with annotation_row / annotation_col. For most work, prefer pheatmap().
datanovia.com
datanovia.com โบ learn โบ machine learning โบ clustering heatmaps in r: heatmap, pheatmap & more
Clustering Heatmaps in R: heatmap, pheatmap & More โ Datanovia
R Graph Gallery
r-graph-gallery.com โบ 215-interactive-heatmap-with-plotly.html
Plotly heatmap โ the R Graph Gallery
You can build heatmaps specifying heatmap in the type argument. You have to provide a square matrix. Try: to zoom, to hover, to export to png and to slide axis. Double click to re-initialize. Note: You probably need to use the layout() function to increase the left margin (l for left). Otherwise row labels will be cut. # Load the plotly package library(plotly) # Data: mtcars: data <- as.matrix(mtcars) # basic heatmap p <- plot_ly(x=colnames(data), y=rownames(data), z = data, type = "heatmap") %>% layout(margin = list(l=120)) p # save the widget # library(htmlwidgets) # saveWidget(p, file=paste0( getwd(), "/HtmlWidget/plotlyHeatmap1.html"))
Plotly
plotly.com โบ r โบ reference โบ heatmap
R Figure Reference: heatmap Traces
For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S./" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. yhoverformat Parent: data[type=heatmap] Type: string Default: "" Sets the hover text formatting rulefor `y` using d3 formatting ...
TutorialsPoint
tutorialspoint.com โบ plotly โบ plotly_heatmap.htm
Plotly - Heatmap
] harvest = np.array( [ [0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0], [2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0], [1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0], [0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0], [0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0], [1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1], [0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3] ] ) trace = go.Heatmap( x = vegetables, y = farmers, z = harvest, type = 'heatmap', colorscale = 'Viridis' ) data = [trace] fig = go.Figure(data = data) iplot(fig)
YouTube
youtube.com โบ watch
Heatmap in R (3 Examples) | Base R, ggplot2 & plotly Package | How to Create Heatmaps - YouTube
How to draw a heatmap in the R programming language. More details: https://statisticsglobe.com/heatmap-in-rR code of this video:##### Example dataset.seed(12...
Published: October 26, 2019
Talgalili
talgalili.github.io โบ heatmaply
Interactive Cluster Heat Maps Using plotly and ggplot2 โข heatmaply
Create interactive cluster heatmaps that can be saved as a stand- alone HTML file, embedded in R Markdown documents or in a Shiny app, and available in the RStudio viewer pane. Hover the mouse pointer over a cell to show details or drag a rectangle to zoom. A heatmap is a popular graphical ...
CRAN
cran.r-project.org โบ web โบ packages โบ heatmaply โบ vignettes โบ heatmaply.html
Introduction to heatmaply - CRAN
Some aspects of heatmaply may not function identically when using plot_method = "plotly" relative to how they function when using plot_method = "ggplot" (the default), however in the majority of cases the output is equivalent. Using this option results in faster heatmaps capable of handling larger matrices. ... # Example for using RowSideColors x <- as.matrix(datasets::mtcars) rc <- colorspace::rainbow_hcl(nrow(x)) library("gplots")
Starred by 406 users
Forked by 75 users
Languages: R 99.8% | Makefile 0.2%
Plotly
plotly.com โบ python โบ heatmaps
Heatmaps in Python
Plotly Express is the easy-to-use, high-level interface to Plotly, which operates on a variety of types of data and produces easy-to-style figures. With px.imshow, each value of the input array or data frame is represented as a heatmap pixel. The px.imshow() function can be used to display heatmaps (as well as full-color images, as its name suggests). It accepts both array-like objects like lists of lists and numpy or xarray arrays, as well as supported DataFrame objects. For more examples using px.imshow, including examples of faceting and animations, as well as full-color image display, see the the imshow documentation page.
CRAN
cran.r-project.org โบ package=heatmaply
heatmaply: Interactive Cluster Heat Maps Using 'plotly' and 'ggplot2'
July 12, 2025 - 'Heatmaps' are used in many fields for visualizing observations, correlations, missing values patterns, 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' and 'plotly.js' engine.
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.
Rdrr.io
rdrr.io โบ cran โบ heatmaply โบ man โบ heatmaply.html
heatmaply: Cluster heatmap based on plotly in heatmaply: Interactive Cluster Heat Maps Using 'plotly' and 'ggplot2'
October 7, 2023 - heatmaply(x, ...) heatmaply_na(x, grid_gap = 1, colors = c("grey80", "grey20"), ...) heatmaply_cor(x, limits = c(-1, 1), colors = cool_warm, ...) ## Default S3 method: heatmaply( x, colors = viridis(n = 256, alpha = 1, begin = 0, end = 1, option = "viridis"), limits = NULL, na.value = "grey50", ...
