增加R图中仅1轴值的字体大小

时间:2017-03-29 16:43:05

标签: r plot

我想知道如何增加" 6" 的字号在我的x轴中的下图? (请参阅下面的R代码

enter image description here

这是我的R代码:

plot(1:10, ty = 'n', ann = F, xaxt = 'n', yaxt = 'n')

axis(side = 1, at = 1:10, font = 2)

2 个答案:

答案 0 :(得分:1)

另一种解决方案

plot(1:10, ty = 'n', ann = F, xaxt = 'n', yaxt = 'n')
axis(1, 1:10, labels = NA)
mtext(text = "6", side = 1, line = 1, at = 6, cex = 3, font = 2, padj = 0.5)
mtext(text = paste(c(1:5,7:10)), side = 1, line = 1,
                        at = c(1:5,7:10), cex = 1, font = 2, padj = 0.5)

答案 1 :(得分:0)

您需要在另一个cex.axis专用号码6中使用axis

plot(1:10, ty = 'n', ann = F, xaxt = 'n', yaxt = 'n')
axis(side = 1, at = c(1:5,7:10), font = 2)
axis(side = 1, at = 6, , font = 2, cex.axis=2)

enter image description here

编辑要根据要求降低6,请使用line

plot(1:10, ty = 'n', ann = F, xaxt = 'n', yaxt = 'n')
axis(side = 1, at = c(1:5,7:10), font = 2)
axis(side=1, at = 6, labels=FALSE,tick=TRUE) #draw normal tick, no label
axis(side = 1, at = 6, , font = 2, cex.axis=2, line=0.5,tick = FALSE)

enter image description here