Hello I used this code in order to get a ggplot figure :
ggplot(mod_mat_constraint, aes(x=Categorie, y=label)) + scale_fill_manual(values = c("#86d65e","#404040","#86d65e","#40c5e8","#e84a4a","#86d65e","#404040","#e2e2e2"), breaks=label_text) +
theme_tree2() + geom_tile(aes(fill = Value), colour = "black") + facet_wrap(~ facet) +
scale_y_discrete(limits=rev(list_tax_order))+
coord_cartesian(clip='off') +
annotation_custom(valigned,xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)+
theme(legend.position="none",plot.margin = unit(c(0, 12, 0, 0), "cm"))
so it just display a heatmap with a table next to it.
In order to add the the table I use then : annotation_custom(valigned,xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
so I can move the table everywhere I want but I do not know how I can deal with the size of the df ?
I previously create the table with :
g1<-tableGrob(Resricted_df_heatmap3[1],rows = NULL)
g2<-tableGrob(Resricted_df_heatmap3[2],rows = NULL)
valigned <- gtable_combine(g1,g2, along=2)
valigned<- gtable_add_grob(valigned ,
grobs = rectGrob(gp = gpar(fill = NA, lwd = 3)),
t = 1, b = nrow(valigned), l = 1, r = ncol(valigned))