tabplot 图主题颜色

tabplot graph theme color

我正在使用 tabplot 包来可视化我的数据集。如何更改表格图中条形图之间 space 的颜色?在下图中,spaces 的颜色是白色,我们如何将其更改为另一种颜色?我在附图中用箭头标记了 spaces

library(ggplot2)
library(tabplot)
data("diamonds")
tableplot(diamonds)

这个问题很难回答。但我可以给出一些我找到的想法。 问题是 tabplot-object 既不是 ggplot 也不是 plot 对象。

所以我们必须看图的viewportgrid.layout参数。我不习惯那种事情。我的解决方案是:

library(ggplot2)
library(tabplot)
library(grid)
data("diamonds")
tplot <- tableplot(diamonds, plot = F)

grid.rect(gp=gpar(fill="red",col="black", alpha = 1))
plot(tplot, vp = viewport(width = 1, height = 1))