代码改变世界

R 如何 隐藏坐标轴

2015-08-11 16:07  xplorerthik  阅读(1531)  评论(0编辑  收藏  举报

x = c(7,5,8)
dim(x)<-3
names(x)<-c("apple","banana", "cherry")
plot(x, type="b",xaxt="n", xlab="fruits",ylab="number")
axis(1,1:3,labels = names(x))
#矢量表示
x = c(7,5,8)
names(x)<-c("apple","banana", "cherry")
plot(as.vector(x), type="b",xaxt="n", xlab="fruits",ylab="number")
axis(1,1:3,labels = names(x))