我有如下因素:Barplot轉移中的R
km1 <- c(0.037, 0.066, 0.048, 0.11, 0.105, 0.113, 0.05)
km2 <- c(0.037, 0.062, 0.048, 0.102, 0.106, 0.116, 0.048)
km3 <- c(0.032, 0.05, 0.05, 0.1, 0.106, 0.118, 0.042)
km4 <- c(0.031, 0.052, 0.052, 0.086, 0.09, 0.114, 0.04)
km5 <- c(0.037, 0.074, 0.046, 0.12, 0.114, 0.132, 0.044)
km6 <- c(0.037, 0.062, 0.046, 0.1, 0.106, 0.118, 0.042)
age <- c(30,45,60,75,90,105,120)
mydata <- matrix(c(km1, km2, km3, km4, km5, km6), nrow = 6, ncol = 7, byrow = TRUE)
barplot(mydata, beside = TRUE,
col = c("yellow","blue","indianred","red2","green","purple"),
legend.text = rownames(age),
xlab = "age", ylab="GR",
ylim=c(0.000, 0.200),
xlim=c(30,120),
axes=FALSE, las=2)
box()
axis(side=1, at=seq(30,120, by=15), cex.axis=0.8, tck=0.02)
axis(side=2, at=seq(0.000, 0.200, by=0.025), cex.axis=0.8, tck=0.02, las=1)
我需要每個coloumn的確切日期設置。但是當我試圖使用這些代碼時,圖像會移動。
這裏的結果:
什麼究竟錯呢?
我不完全清楚你想達到什麼樣的目標......你可以張貼你想要的結果嗎?無論如何,罪魁禍首是'xlim'; barplot自動計算列的位置(並將其無形地返回),強制它在30-120之間,你正在移動圖... – digEmAll