Open IgnatiusPang opened 5 years ago
Unfortunately I don't think that is possible at the moment! And my understanding is that plotly doesn't make this easy...
Thank you Alicia. I understand now. Many thanks for maintaining this wonderful package which I use quite often. I've also used it and cited it in one publication (https://academic.oup.com/ofid/article/6/2/ofz025/5290392). My collaborator made some edits in photoshop / illustrator.
Igy
On Sat, Aug 24, 2019 at 9:07 AM Alicia Schep notifications@github.com wrote:
Unfortunately I don't think that is possible at the moment! And my understanding is that plotly doesn't make this easy...
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ropensci/iheatmapr/issues/46?email_source=notifications&email_token=AARWXVVI7ZIZI5WDMPTW7N3QGBUTDA5CNFSM4HKRR2TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5BQ6CY#issuecomment-524488459, or mute the thread https://github.com/notifications/unsubscribe-auth/AARWXVWFI7EUJ7CV5ZQKD53QGBUTDANCNFSM4HKRR2TA .
stumbled upon this and came up with something that works for my usecase, this depends on using the plotly
package to render it either locally or on shiny. This also requires the NA values to be of class character
for factor
this doens't work
hm_list <- to_plotly_list(hm)
convert_NA_colors <- function(hm_list, na_color = "#828282"){
hm_data <- hm_list[['data']]
for(i in seq_along(hm_data)){
if('ticktext' %in% names(hm_data[[i]]$colorbar)){
if('NA' %in% hm_data[[i]]$colorbar$ticktext){
which_na <- which(hm_data[[i]]$colorbar$ticktext == 'NA')
idx <- c(which_na*2, which_na*2-1)
hm_data[[i]]$colorscale[idx, 2] <- na_color
}
}
}
hm_list[['data']] <- hm_data
hm_list
}
plotly::plotly_build(hm_list)
Dear Alicia,
I have got a feature suggestion. At the moment I see that NA values are displayed as the color white in the heat map. Unless I missed it (which could be the case) there is currently no means of changing the color of NA cells in the heat map. Would it be possible to add a feature to change / customise the value of the NA cells? (Been using iheatmapr for many of my projects now. Thank you!)
Kind Regards,
Igy