axis函数用来在一张图表上添加轴线,区别于传统的x轴和y轴,axis 允许在上,下,左, 右4个方向添加轴线
以x轴为例,一条轴线包含3个元素,水平的一条横线,叫做axis line , 刻度线, 叫做tick line, 对应的标签 labels
基本用法:
通过side 参数设置需要添加的轴线的方向,从下边开始,沿逆时针方向,数字为1到4
代码示例:
par(oma = c(1, 1, 1, 1), mfrow = c(1, 4)) plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", axes = F) text(x = 3, y = 3, labels = "side = 1", cex = 2) box() axis(side = 1) plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", axes = F) text(x = 3, y = 3, labels = "side = 2", cex = 2) box() axis(side = 2) plot(1:5, 1:5, xlim = c(0,6), ylim = c (0,6), type = "n", axes = F) text(x = 3, y = 3, labels = "side = 3&#