【发布时间】:2016-08-31 12:32:30
【问题描述】:
我有一个水平条形图,x 轴中间为零,并且希望每个条形的名称与条形本身出现在同一侧。我使用的代码是:
abun<-data$av.slope
species<-data$Species
cols <- c("blue", "red")[(abun > 0)+1]
barplot(abun, main="Predicted change in abundance", horiz=TRUE,
xlim=c(-0.04,0.08), col=cols, names.arg=species, las=1, cex.names=0.6)
我尝试创建两个单独的轴,并且名称确实出现在每个条的所需一侧,但与相应的条不齐。我会尝试上传条形图的图像,我对 R 还是很陌生,如果我遗漏了一些基本的东西,我深表歉意!
barplot1- names in correct position but all on one axis
barplot2- names on both sides of plot but not in line with appropriate bar
【问题讨论】: