小弟纯小白一个...在给barplot作出的条形做标注时遇到了这样的问题,标注的小数点后位数太多了,请问如何设置成小数点后两位。附代码。
options(digits=2)
a=c(Goodcon$INJ_SEV)
b=table(a)
b1=as.vector(b)
c=prop.table(table(a))
c1=as.vector(c)
g=data.frame(b1,c1)
dimnames(g)=list(c('0','1','2','3','4'),c("Frequency","Ratio"))
x<-barplot(g$Ratio,font.lab=2,main="Good Condition",xlab="Injury Severity",ylab="Ratio",
xlim=c(0,6),ylim=c(0,0.7),names.arg=c("0","1","2","3","4"))
gR<-paste(" ",g$Ratio)
text(x,g$Ratio,labels=gR,cex=1.5,pos=3)


雷达卡




京公网安备 11010802022788号







