How to force the labels to fit in VennDiagram?

强颜欢笑 提交于 2019-12-04 03:08:28
user20650

You can justify the label text with cat.just. The package reference manual gives info. on how to pass the parameters.

For your example i used trial and error for the justification values.

# Plot
v <- venn.diagram(list(shams_90d = 1:3, shams_90d_4h = 2:4, sham3__shams_90d = 3:5,
                   sham3_90d__shams = 5:7, sham3_90d__shams_4h = 6:9),
              fill = c("red", "green", "blue", "yellow", "purple"),
              alpha = c(0.5, 0.5,0.5, 0.5, 0.5), cex = 1,cat.fontface = 2,
              lty =1, filename=NULL, cat.cex=0.8, 
              cat.just=list(c(0.6,1) , c(0,0) , c(0,0) , c(1,1) , c(1,0)))

grid.newpage()
grid.draw(v)

Another option (if a bit of a quick hack) would be to remove the cat.just argument and set a smaller grid::viewport. You may need to tweak the width of your graphics window / output device (ie pdf(..., width=...)):

# Plot
v <- venn.diagram(list(shams_90d = 1:3, shams_90d_4h = 2:4, sham3__shams_90d = 3:5,
                   sham3_90d__shams = 5:7, sham3_90d__shams_4h = 6:9),
              fill = c("red", "green", "blue", "yellow", "purple"),
              alpha = c(0.5, 0.5,0.5, 0.5, 0.5), cex = 1,cat.fontface = 2,
              lty =1, filename=NULL, cat.cex=0.8)

grid.newpage()
pushViewport(viewport(width=unit(0.8, "npc"), height = unit(0.8, "npc")))
grid.draw(v)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!