如何使x轴中的字体大小变量更小

KB2*_*KB2 2 r bar-chart

我有这个代码来创建条形图,但我想将x轴中的名称更改为种类名称,例如,我想让字体更小,以便我可以适应它.我已经尝试使用cex功能有多种组合,但还没有奏效.我很感激你的建议?

    count <-     
    matrix(c(16,102,11,106,15,95,26,87,18,99,21,103,12,110,30,103,10,107,20,87,13,110,17,93),     nrow = 2)  


    barplot(count, beside=T, legend =T, ylim=c(0,130),
    col=c("darkolivegreen3", "firebrick1"), 
    ylab="Frequency (no. of moths)", las = 3, 
    names = c("tiger\nCo", "tiger\nCr" , "eyes\nCo", "eyes\nCr", "mottled\nCo","mottled\nCr",  "pepperL\nCo","pepperL\nCr", "pepperD\nCo","pepperD\nCr", "convol\nCo", "convol\nCr"))        


    legend(6,130, legend=(c("survived","predated")), pch=c(15,22), cex=0.8,    col=c("darkolivegreen3","firebrick1"))
Run Code Online (Sandbox Code Playgroud)

42-*_*42- 7

那么,根据?barplot页面有一个cex.names论点:

barplot(count, beside=T, legend =T, ylim=c(0,130),
    col=c("darkolivegreen3", "firebrick1"), 
    ylab="Frequency (no. of moths)", las = 3, 
    cex.names=0.8,
    names.arg = c("tiger\nCo", "tiger\nCr" , "eyes\nCo", "eyes\nCr", 
                   "mottled\nCo","mottled\nCr",  "pepperL\nCo", 
                   "pepperL\nCr", "pepperD\nCo","pepperD\nCr", 
                    "convol\nCo", "convol\nCr"))        
    legend(6,130, legend=(c("survived","predated")), pch=c(15,22),    
                          col=c("darkolivegreen3","firebrick1"))
Run Code Online (Sandbox Code Playgroud)

我承认,寻找合适的CEX.*参数有时是困难的,有时需要到轴单独调用,但这里似乎临近你们微不足道.