這裏的情節,包括傳說中的代碼:要彩色線條加入到複雜的情節傳奇
png(filename=paste0(filename2, SubNameStr, "_", date, "_", BlankUncertainty, "-percent-blank-unc_", "no_add_unc", "_", " (R#_yyyy-mm-dd_hh-mm-ss).png"),
type="cairo",
units="cm",
width=30,
height=15,
pointsize=12,
res=resolution)
par(mar =c(10, 4, 4, 2)+0.1)
plotCI(1:abscissa,
LoopVariable[ ,"F_corrected_normed"],
xlim=c(0, abscissa + 1),
ylim=c(LoopVariable[1,"weighted_mean_fraction_modern"] - (LoopVariable[1,"weighted_mean_fraction_modern"] * y),
LoopVariable[1,"weighted_mean_fraction_modern"] + (LoopVariable[1,"weighted_mean_fraction_modern"] * y)),
xaxs="i",
yaxs="i",
uiw=LoopVariable[ ,"F_corrected_normed_error_NOSYSERR"], err="y",
main=(LoopVariable[1,"Samples..Sample_ID"]),
xlab="", ylab="F_modern",
pch=19
)
if (LoopVariable[1,"Job..R"] == "14047/2")
abline(h=IAEA_C2consensus, lwd=1, col="blue", lty=11)
if (LoopVariable[1,"Job..R"] == "18331/3")
abline(h=TIRI_Iconsensus, lwd=1, col="blue", lty=11)
if (LoopVariable[1,"Job..R"] == "24889/3")
abline(h=FIRI_Cconsensus, lwd=1, col="blue", lty=11)
if (LoopVariable[1,"Job..R"] == "18331/4")
abline(h=TIRI_Jconsensus, lwd=1, col="blue", lty=11)
if (LoopVariable[1,"Job..R"] == "24889/4")
abline(h=FIRI_DFconsensus, lwd=1, col="blue", lty=11)
if (LoopVariable[1,"Job..R"] == "24889/5")
abline(h=FIRI_Econsensus, lwd=1, col="blue", lty=11)
if (LoopVariable[1,"Job..R"] == "24889/9")
abline(h=FIRI_Iconsensus, lwd=1, col="blue", lty=11)
abline(h=LoopVariable[1,"weighted_mean_fraction_modern"], lwd=1, col="red")
mtext(paste0("no additional error added, ", BlankUncertainty, " Blk unc, ", date))
if (LoopVariable[1,"Job..R"] == "14047/2") {
legend("bottom",
xpd = TRUE,
inset=c(0,-0.6),
legend=c(paste0("degrees of freedom = ", LoopVariable[1,"degrees_of_freedom"]),
paste0("Chi square = ", LoopVariable[1,"Chi_square"]),
paste0("Chi square reduced = ", LoopVariable[1,"Chi_square_reduced"]),
paste0(" F_weighted_mean = ", LoopVariable[1,"weighted_mean_fraction_modern"]),
paste0(" F_consensus = ", IAEA_C2consensus))
)
}
else {
legend("bottom",
xpd = TRUE,
inset=c(0,-0.6),
legend=c(paste0("degrees of freedom ", LoopVariable[1,"degrees_of_freedom"]),
paste0("Chi square ", LoopVariable[1,"Chi_square"]),
paste0("Chi square reduced ", LoopVariable[1,"Chi_square_reduced"]),
paste0(lty=1, col="red", " F_weighted_mean = ", LoopVariable[1,"weighted_mean_fraction_modern"])
)
)}
dev.off()
我的問題是,我怎樣才能增加一個簡短的紅色和藍色的線,我的最後一個用於圖例的線條,以便F_consensus和F_weighted_mean值可用於圖中正確的顏色abline
。 這裏是形式我的示例代碼生成的情節:要指定的參數lty
和col
這樣
查看文檔後,它看起來很容易,但它似乎沒有任何測試數據。 (你沒有加載pkg:plotrix。) – 2015-02-10 04:34:53
'@ BondeDust'我確實加載了庫的plotrix,我只是在這裏沒有提到它。對困惑感到抱歉! – Johannes 2015-02-10 19:54:50