ropensci / iheatmapr

Complex, interactive heatmaps in R
https://docs.ropensci.org/iheatmapr
Other
267 stars 35 forks source link

Show_title option of add_row_groups and add_col_groups not working #17

Closed dunhamc closed 6 years ago

dunhamc commented 6 years ago

I am having an issue with the show_title feature of your add_row_groups and add_col_groups methods. The method works perfectly in every aspect except for the addition of the title feature. When I run the code you use on your home page as an example, the result is again an interactive plot without the column groups annotation title of "Vaccine?" (which is in contrast to the image of the interactive heatmap that you have on your homepage). I have included my R session information as well as a screenshot of the image I get from the below code. measles_cases

library(iheatmapr) data(measles, package = "iheatmapr")

main_heatmap(measles, name = "Measles
Cases", x_categorical = FALSE, layout = list(font = list(size = 8))) %>% add_col_groups(ifelse(1930:2001 < 1961,"No","Yes"), side = "bottom", name = "Vaccine
Introduced?", title = "Vaccine?", colors = c("lightgray","blue")) %>% add_col_labels(ticktext = seq(1930,2000,10),font = list(size = 8)) %>% add_row_labels(size = 0.3,font = list(size = 6)) %>% add_col_summary(layout = list(title = "Average
across
states"), yname = "summary") %>%
add_col_title("Measles Cases from 1930 to 2001", side= "top") %>% add_row_summary(groups = TRUE, type = "bar", layout = list(title = "Average
per
year", font = list(size = 8)))

R version 3.4.1 (2017-06-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] iheatmapr_0.4.0

loaded via a namespace (and not attached): [1] Rcpp_0.12.12 digest_0.6.12 plyr_1.8.4 jsonlite_1.5 stats4_3.4.1
[6] magrittr_1.5 scales_0.5.0 S4Vectors_0.14.4 fastcluster_1.1.24 RColorBrewer_1.1-2 [11] tools_3.4.1 htmlwidgets_0.9 munsell_0.4.3 yaml_2.1.14 parallel_3.4.1
[16] compiler_3.4.1 colorspace_1.3-2 BiocGenerics_0.22.0 htmltools_0.3.6 knitr_1.17

AliciaSchep commented 6 years ago

Thanks for bringing up this issue and providing a reproducible example! There is a bug in the iheatmapr package code such that while the title should in theory be displayed, it does not show up because the position is incorrectly off the axis. I have introduced a fix in v 0.4.1, which should solve this issue.

dunhamc commented 6 years ago

That did the trick! Thank you for developing this awesome resource. :)