cran / multipanelfigure

:exclamation: This is a read-only mirror of the CRAN R package repository. multipanelfigure — Infrastructure to Assemble Multi-Panel Figures (from Grobs)
3 stars 1 forks source link

Could not use Heatmap generated using Heatmap function with the capture_base_plot function #3

Open gowthamee opened 5 years ago

gowthamee commented 5 years ago

This is my code to generate the heatmap:

p_heat <- Heatmap(as.matrix(ZZZ), 
                      col = inferno(100),
                      rect_gp = gpar(col = "black", lty = 1, lwd = 2),
                      name = "log2FC",
                      #cell_fun = cell_fun,
                      cluster_columns = FALSE,
                      cluster_rows = FALSE,
                      #row_dend_gp = gpar(col = c("#440154FF", "#22A884FF", "#433E85FF", "#2BB07FFF")),
                      show_row_dend = TRUE,
                      row_dend_side = "left",
                      row_dend_width = unit(2, "cm"),
                      #row_split = 2,
                      show_row_names = TRUE,
                      row_names_gp = gpar(fontsize = 4.5, fontface = "bold"),
                      column_names_side = "top",
                      column_names_gp = gpar(fontsize= 10, fontface = "bold", 
                                             col = c(rep("#440154FF", 4), rep("#FFEA46FF", 4))),
                      #column_names_rot = 45,
                      km = 4,
                      gap = unit(3, "mm"),
                      combined_name_fun = NULL,
                      show_heatmap_legend = TRUE)

Using this code I could generate a heatmap. However, when the object p_heat is used in the following function

heat_map <- capture_base_plot(p_heat)

I get the following error and some warnings

Error in switch(x[[2]][[1]]$name, C_abline = C_abline(x[[2]]), C_plot_new = C_plot_new(x[[2]]), :

EXPR must be a length 1 vector

In addition: There were 28 warnings (use warnings() to see them)

Any help is appreciated. thanks !!!