I posted this on stackoverflow but didn’t receive any responses there.
I am trying to add plotly transform functions to heatmaps, with the ultimate goal that the heatmap will have a dropdown to allow me to select which data I want in my heatmap. The problem I’m running into is that adding a transforms attribute to a plot_ly heatmap call seems to cause the tooltip to no longer work.
Does anyone know how to get the tooltips to work?
I’ve recreated the problem based on the filter transform example from plotly (Filter in R)
library(plotly)
Tooltips work
p1 ← plot_ly(
type = ‘heatmap’,
x = mtcars$hp,
y = mtcars$qsec,
z = mtcars$carb,
text = rownames(mtcars),
hoverinfo = ‘text’
)Tooltips don’t work
p2 ← plot_ly(
type = ‘heatmap’,
x = mtcars$hp,
y = mtcars$qsec,
z = mtcars$carb,
text = rownames(mtcars),
hoverinfo = ‘text’,
transforms = list(
list(
type = ‘filter’,
target = ‘y’,
operation = ‘>’,
value = mean(mtcars$qsec)
)
)
)