任何人都可以帮助弄清楚为什么我的y轴和x轴标签没有出现?

时间:2015-03-15 13:15:27

标签: r plot panel

作为我的代码的一部分,我有一个4行乘2列面板和8个图表,我建议使用下面的代码作为示例,但是这样做时我无法获得y和x轴上的文本。请参阅下面的代码。

#This is the code to have the plots as 4 x 2 in the page 
m <- rbind(c(1,2,3,4), c(5,6,7,8) )
layout(m)
par(oma = c(6, 6, 1, 1)) # manipulate the room for the overall x and y axis titles
par(mar = c(.1, .1, .8, .8)) # manipulate the plots be closer together or further apart

###this is the code to insert for instance one of my linear regression plots as part of this panel (imagine I have other 7 identical replicates of this)
####ASF 356 standard curve 
asf_356<-read.table("asf356.csv", head=TRUE, sep=',')
asf_356

# Linear Regression  
fit <- lm( ct ~ count, data=asf_356)
summary(fit) # show results
predict.lm(fit, interval = c("confidence"), level = 0.95, add=TRUE)
newx <- seq(min(asf_356$count), max(asf_356$count), 0.1)
a <- predict(fit, newdata=data.frame(count=newx), interval="confidence")
plot(x = asf_356$count, y = asf_356$ct, xlab="Log(10) for total ASF 356 genome copies", ylab="Cycle threshold value", xlim=c(0,10), ylim=c(0,35), lty=1, family="serif")
curve(expr=fit$coefficients[1]+fit$coefficients[2]*x,xlim=c(min(asf_356$count),                                                       max(asf_356$count)),col="black", add=TRUE, lwd=2) 
lines(newx,a[,2], lty=3)
lines(newx,a[,3], lty=3)
legend(x = 0.5, y = 20, legend = c("Logistic regression model", "95% individual confindence interval"), lty = c("solid", "dotdash"), col = c("black", "black"), enter code herebty = "n")    
mod.fit=summary(fit)
r2 = mod.fit$r.squared
mylabel = bquote(italic(R)^2 == .(format(r2, digits = 3)))
text(x = 8.2, y = 25, labels = mylabel)
legend(x = 7, y = 35, legend =c("y= -3.774*x + 41.21"), bty="n")

1 个答案:

答案 0 :(得分:0)

我能够在这里找到类似的帖子,我失踪的论点是:

title(xlab="xx", ylab="xx", outer=TRUE, line=3, family="serif")

由于

最后,我有我的工作......感谢之前帮助过我的人