我正在尝试绘制下面的数据,我没有得到我在下面的代码中指定的x轴值?我不知道我在哪里做错了。
Product <- c("Nestle","Kitkat","Barbon","perk","Munch")
Sales <- c(200,300,250,100,150)
Share <- c(20.0,30.0,25.0,10.0,15.0)
P <- data.frame(Product,Sales,Share)
par(mar=c(2,3,2,5),col.axis = "black")
barplot(P$Sales,col = "green",xlab = Product,ylab = "")
par(new=TRUE)
plot(P$Share, type = "o",col="dark blue",bty = "n", xlab = Product, ylab = "")
axis(side = 4)
mtext("share",side=4,line=3)
legend("topleft",col=c("green"," dark blue"),lty=1,legend=c("Sales","Share"))