如何更改维恩图字体

时间:2019-06-13 15:09:42

标签: r

我正在尝试将维恩图的字体更改为arial。

基于此处VennDiagram without group names and with Arial font先前的stackoverflow问题,我尝试将fontfamily =“ arial”添加到代码中,但是没有用。

venn.plot <- draw.quad.venn(
area1 = 72,
area2 = 86,
area3 = 50,
area4 = 52,
n12 = 44,
n13 = 27,
n14 = 32,
n23 = 38,
n24 = 32,
n34 = 20,
n123 = 18,
n124 = 17,
n134 = 11,
n234 = 13,
n1234 = 6,
category = c("Workshops", "STEM Tours", "Summer Apprenticeships", 
"Convocation"),
fill = c("antiquewhite4", "cornflowerblue", "gold1", "lightpink2"),
lty = 0, #this gets rid of border
fontfamily ="arial",
cex = 1, 
cat.cex = 2,
cat.col = c("antiquewhite4", "cornflowerblue", "gold1", "lightpink2")
);

1 个答案:

答案 0 :(得分:0)

在我的系统(Win64)中,安装extrafont后,您需要运行font_import()(花一些时间),然后运行loadfonts(device = "win")。然后,您可以执行类似wf <- windowsFonts()的操作并浏览wf。就我而言,我可以使用wf$Arial来访问Arial,但是可以使用YMMV。另外,请记住,组的名称在cat.fontfamily参数中。如果您想在Arial中做每件事,

venn.plot <- draw.quad.venn(
    area1 = 72,
    area2 = 86,
    area3 = 50,
    area4 = 52,
    n12 = 44,
    n13 = 27,
    n14 = 32,
    n23 = 38,
    n24 = 32,
    n34 = 20,
    n123 = 18,
    n124 = 17,
    n134 = 11,
    n234 = 13,
    n1234 = 6,
    category = c("Workshops", "STEM Tours", "Summer Apprenticeships", 
                "Convocation"),
    fill = c("antiquewhite4", "cornflowerblue", "gold1", "lightpink2"),
    lty = 0, #this gets rid of border
    fontfamily = wf$Arial,
    cex = 1, 
    cat.cex = 2,
    cat.fontfamily = wf$Arial,
    cat.col = c("antiquewhite4", "cornflowerblue", "gold1", "lightpink2")
);