r plot main,R plot 主选项中的迭代器
r plot main, iterator in the main option of a R plot
我需要一种方法来用它的迭代器 "i" 来更改主图,例如 main = "Grafico de credibilidad" + i,然后当 6 个图出现时,它们的标题会更改为 "Grafico de credibilidad 1" 和 1 增加。
momentos1 <- read.table("momentos1.txt")
par(mfrow = c(2,3),bg = "white")
x<-seq(0,1,0.01)
for(i in 1:6){
plot(x,dbeta(x,momentos1$alpha.1.30.[i],momentos1$beta.1.30.[i]),
main = "Grafico Credibilidad",axes = F,col="blue",
ylab = "",
xlab = "",
ylim = c(0,5),type = "l"
)
axis(1,at = seq(0,1,0.1),las=1)
box()
grid()
}
非常感谢。
您可以使用paste()
momentos1 <- read.table("momentos1.txt")
par(mfrow = c(2,3),bg = "white")
x<-seq(0,1,0.01)
for(i in 1:6){
plot(x,dbeta(x,momentos1$alpha.1.30.[i],momentos1$beta.1.30.[i]),
main = paste("Grafico Credibilidad ",i),axes = F,col="blue",
ylab = "",
xlab = "",
ylim = c(0,5),type = "l"
)
axis(1,at = seq(0,1,0.1),las=1)
box()
grid()
}
我需要一种方法来用它的迭代器 "i" 来更改主图,例如 main = "Grafico de credibilidad" + i,然后当 6 个图出现时,它们的标题会更改为 "Grafico de credibilidad 1" 和 1 增加。
momentos1 <- read.table("momentos1.txt")
par(mfrow = c(2,3),bg = "white")
x<-seq(0,1,0.01)
for(i in 1:6){
plot(x,dbeta(x,momentos1$alpha.1.30.[i],momentos1$beta.1.30.[i]),
main = "Grafico Credibilidad",axes = F,col="blue",
ylab = "",
xlab = "",
ylim = c(0,5),type = "l"
)
axis(1,at = seq(0,1,0.1),las=1)
box()
grid()
}
非常感谢。
您可以使用paste()
momentos1 <- read.table("momentos1.txt")
par(mfrow = c(2,3),bg = "white")
x<-seq(0,1,0.01)
for(i in 1:6){
plot(x,dbeta(x,momentos1$alpha.1.30.[i],momentos1$beta.1.30.[i]),
main = paste("Grafico Credibilidad ",i),axes = F,col="blue",
ylab = "",
xlab = "",
ylim = c(0,5),type = "l"
)
axis(1,at = seq(0,1,0.1),las=1)
box()
grid()
}