以下代码:
avector <- as.vector(top.links.added.overall$Amount)
x <- as.vector(top.links.added.overall[order(avector),])
row.names(x) <- c("Yahoo" ,"Cnn", "Google")
x$color[x$Amount == 100] <- "red"
x$color[x$Amount == 500] <- "blue"
x$color[x$Amount == 1000] <- "darkgreen"
dotchart(x$Amount,
labels = row.names(x),
cex=.7,
groups = x$Amount,
gcolor = "black",
color = x$color,
pch=19,
main = "Gas Mileage for Car Models\ngrouped by cylinder",
xlab = "Miles Per Gallon")
生成此图:
这是数据集 top.links.added.overall$Amount 的格式:
这是文件数据集:
Amount,Name
1000,Google
500,Cnn
100,Yahoo
当我删除代码时:
row.names(x) <- c("Yahoo","Cnn","Google")
我得到 1,2,3 的行名
我不需要我应该需要设置'y'轴的名称?如何修改图表的代码,以使数值最低的公司(在本例中为雅虎)从“y”轴的开头而不是顶部开始,目前正在发生什么?