如何在条形图中更改x坐标?

时间:2013-03-09 14:10:09

标签: r stripchart

在前一个问题中,Ananda Mahto告诉我如何创建一个striochart,
最好将x坐标从0,2,4,6,8,10(在图1中)更改为0,1,2,3,4,5,6,7,8,9(在图2中)<登记/> 怎么改呢?

set.seed(1)
A <- sample(0:10, 100, replace = TRUE)
stripchart(A, method = "stack", offset = .5, at = .15, pch = 19, 
       main = "Dotplot of Random Values", xlab = "Random Values")

我想要的是graph2.png而不是graph1.png。

graph1.png

enter image description here

graph2.png

enter image description here

1 个答案:

答案 0 :(得分:3)

A <- sample(0:9, 100, replace = TRUE)
stripchart(A, method = "stack", offset = .5, at = .15, pch = 19, 
           main = "Dotplot of Random Values", xlab = "Random Values",xaxt="n")
axis(1, at = 0:9, labels = 0:9)