talgalili / heatmaply

Interactive Heat Maps for R Using plotly
380 stars 73 forks source link

Is it possible to have `custom_hovertext` appear on row/col side? #268

Open bjohnnyd opened 3 years ago

bjohnnyd commented 3 years ago

I would like to add numerical values to be displayed on hover over a categorical row/col side.

I thought that creating an identical dataframe and overwriting the categorical column with numerical values and then passing this dataframe to custom_hovertext would make this work.

library(heatmaply)

# e.g. showing just the actual value twice on hover does not work
mtcars$test_col <- "test"
heatmaply(mtcars, custom_hovertext = mtcars)

# e.g. substituting the categorical with numeric does not work for the row/col side
mtcars_w_num_for_categorical <- mtcars
mtcars_w_num_for_categorical[] <- 10**6

heatmaply(mtcars, custom_hovertext = mtcars_w_num_for_categorical)
alanocallaghan commented 3 years ago

This requires adding col_side_hovertext and row_side_hovertext args

bjohnnyd commented 3 years ago

Ok, thanks. I was thinking that custom_hovertext will apply to the whole heatmap, not just the core. I guess this is in essence core_heatmap_hovertext.

alanocallaghan commented 3 years ago

Probably when the categorical columns are pulled out we can also pull out the accompanying hovertext for those columns, but yeah unfortunately atm there's no custom hovertext for colsidecolors or rowsidecolors afaik