Text alignment and font size in gtable

后端 未结 2 1061
别那么骄傲
别那么骄傲 2020-12-21 18:11

My question relates to the answer by Baptiste that you can find here: https://stackoverflow.com/a/18667413/2072440.

That code does pretty what I want it to do. I wou

2条回答
  •  时光取名叫无心
    2020-12-21 18:59

    I've added a table function in gtable, with more options.

    It's really slow, unfortunately (and unsurprisingly for grid graphics).

    enter image description here

    require(gtable)
    
    d <- head(iris, 3)
    
    core <- gtable_table(d,
                         fg.par = list(col=1:8, hjust=0, x=0.1),
                         bg.par = list(fill=9:15, alpha=0.5))
    
    colhead <- gtable_table(t(colnames(d)), fg.par = list(fontface=4),
                            bg.par = list(col=NA))
    
    rowhead <- gtable_table(c("", rownames(d)), fg.par = list(fontface=3),
                            bg.par = list(col=NA))
    
    g <- rbind(colhead, core)
    g <- cbind(rowhead, g)
    
    grid.newpage()
    grid.draw(g)
    

提交回复
热议问题