Search code examples
rbar-chartlarge-data

tabplot graph theme color


Table plot bar chart spaceI'm using tabplot package to visualize my data set. How is it possible to change the color of the space between the barcharts in tableplot? In the following graph the color of the spaces is white, how can we change it into another color? I marked the spaces with arrows in the attached plot

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

Solution

  • The question is far from being easy to answer. But I can give some of the ideas I find. The problem is that tabplot-object are neither ggplot nor plot object.

    So we must look at the viewport and grid.layout parameter of the graph. I'm not used to that type of things. My solution is :

    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))
    

    enter image description here