I am trying to plot with ggplot2, where on the X axis I could find a way to have a label for groups of variables. Here is the minimal version of my code:
Bzero <-100*matrix(runif(100),ncol=10,nrow=10) B <-99 LNtype <-c(1,1,1,1,2,2,2,3,3,3) LNnames <-c('grp1','grp2','grp3') tB <-t(Bzero)/(B+1) dfB <-data.frame(tB) dfB$grp <-LNtype dfB$vid <-1:nrow(tB) mB0 <- melt(dfB,id.vars=c('grp','vid')) mB0 <- mB0[order(mB0$grp,mB0$vid),] gg0 <- ggplot(mB0,aes(x=vid,y=variable)) gg0 <- gg0 + geom_tile(aes(fill = value),colour = "white") gg0 <- gg0 + scale_fill_gradient(low = "green", high = "red",na.value='white',limits=c(0,1),name='p0i') gg0 <- gg0 + xlab('Equation')+ylab('Covariate')
Here's the resulting graph:

And here is what I would like to have: 
I did not deal with scaling, breaks and shortcuts. Even a huge number of search queries revealed any plot with such an axis. Is there a way to get what I want?
source share