2
我想定製我的tableGrob中某個特定列的字體顏色。爲R中的tableGrob自定義一列的字體顏色?
Here is the original table,and this is what I would like the table to look like在第五列中的零變更爲「白色」
我已經在這裏跟着洗禮的指示:How do I customize particular columns for a tableGrob in R?,但沒有成功。
這裏是我的簡單的數據框:
count <- data.frame("day17" = c(17, 4, 4, 4, 3, 2),
"day27" = c(27, 4, 5, 5, 5, 1), "day37" = c(37, 5, 5, 4, 4, 3),
"day47" = c(47, 2, 1, 3, 0, 0), "day57" = c("Time (d)", 0, 0, 0, 0, 0))
繼巴蒂斯特的上面的例子,我試圖針對第五列指定顏色:
colours <- matrix(c("black", "white", "white", "white", "white", "white"), ncol=1, nrow=nrow(count), byrow=FALSE)
這裏是產生該表的代碼:
table_theme <- ttheme_minimal(core = list(fg_params=list(col=(colours))))
grid.newpage()
table <- tableGrob(count, theme = table_theme, rows=NULL, cols=NULL)
grid.draw(table)
這段代碼仍然在改變行上的顏色,而不是在一個colu上根據。任何有關這個問題的幫助將不勝感激。
我是新來堆棧溢出,這是我的第一個問題,請原諒我,如果答案實際上是一個代碼錯誤,如缺少括號等!