add_col_groups uses continuous scale if all groups are equal
mschilli87 opened this issue · 2 comments
mschilli87 commented
example from README (works fine):
library(iheatmapr)
data(measles, package = "iheatmapr")
main_heatmap(measles, name = "Measles<br>Cases", x_categorical = FALSE,
layout = list(font = list(size = 8))) %>%
add_col_groups(ifelse(1930:2001 < 1961,"No","Yes"),
side = "bottom", name = "Vaccine<br>Introduced?",
title = "Vaccine?",
colors = c("lightgray","blue"))
Assume vaccine came later (breaks labelling):
library(iheatmapr)
data(measles, package = "iheatmapr")
main_heatmap(measles, name = "Measles<br>Cases", x_categorical = FALSE,
layout = list(font = list(size = 8))) %>%
add_col_groups(ifelse(1930:2001 < 2002,"No","Yes"),
side = "bottom", name = "Vaccine<br>Introduced?",
title = "Vaccine?",
colors = c("lightgray","blue"))
AliciaSchep commented
Thanks for the reproducible example. I think I have found the underlying issue -- when the tickvals and ticktext are passed from R to JSON if the length is one it doesn't get passed as an array. The type being array is important on the JS side. Have implemented a fix with latest github version on master branch.
mschilli87 commented
I can confirm that this is fixed by 04bec9c.