在X轴标签上插入PCH符号

时间:2018-11-20 17:01:18

标签: r

par(mar=c(5,5,2,5), xpd=TRUE)

x <- seq(0,5,0.5)
y <- seq(0,5,0.5)
plot(x,y, xlab="", ylab="")

有没有一种方法可以用符号pch = 2,pch = 4,pch = 6,pch = 8,pch = 10,pch替换x轴标签(0,1,2,3,4,5) = 12?

1 个答案:

答案 0 :(得分:1)

一个相当手动的解决方案,但这通常是您使用基本图形所获得的:

par(mar=c(5,5,2,5), xpd=TRUE)

x <- seq(0,5,0.5)
y <- seq(0,5,0.5)
plot(x,y, xlab="", ylab="",xaxt = "n")
axis(side = 1,at = 0:5,labels = FALSE)
points(x = 0:5,y = rep(-0.5,6),pch = c(2,4,6,8,10,12))

enter image description here