0

Is there a way to put colors on all the cells of a tableGrob that are not 0 ? I have this table with a lot of lines [][1] [1]: https://i.stack.imgur.com/w7RCJ.png

I am using tableGrob and then grid.arrange to put 2 tables on the same page with some text

tab1<-tableGrob(tab_glob,rows=NULL,theme = ttheme_default(10),widths=unit(rep(1/ncol(tab_glob), ncol(tab_glob)), "null"), heights=unit(rep(0.95/nrow(tab_glob), nrow(tab_glob)),"npc"))
tab2<-tableGrob(Notes_tous,rows=NULL,theme = ttheme_default(11))
footnote<- textGrob("Moyenne référence = résultats techniciens référents")
padding<-unit(0.5,"line")
tab3<-gtable_add_rows(tab2, 
                      heights = grobHeight(footnote)+ padding,pos=0)
tab3 <- gtable_add_grob(tab3,list(footnote),
                         t=1, l=1, 
                         r=ncol(tab2))
pdf(paste("Table_",i,".pdf",sep = ""),width=10,height=15) #save in pdf

Point_tab<-grid.arrange(tab1,tab3,ncol=1,nrow=2, top=textGrob("\n \n \nNombre de pointages par note",gp=gpar(fontsize=14,font=3)))

dev.off()

In the first table, showing all the values, I am looking for a way to highlight the values that are not 0 in all the columns. All the answers I have found on the internet are for particular cells or a particular value... Do you have any idea to help me update my code ?

Kind regards,

0 Answers0