how to add two line different labels using grid.xaxis in grid package of R

272 views Asked by At

Goal: plot a fig with the x-axis owing two line labels using grid. such as one line is c("A", "B", "C"), the other line is c("1", "2", "3").

Maybe how to set the edits parameter? Also how to add an annotation after each labels, such as the unit if could? Thank you.

1

There are 1 answers

1
baptiste On BEST ANSWER

Something like this?

library(grid)

grid.newpage()
pushViewport(viewport(y=1, width=0.8))
grid.xaxis(at = seq(0,1,by=0.5), label = paste(letters[1:3],1:3,sep="\n"))

enter image description here