關(guān)于繪圖區(qū)域
概念 | 英文 | 縮寫函數(shù) | 釋義 |
---|---|---|---|
主繪圖 | main plot area | 類比畫布湾宙,整塊畫布 | |
繪圖邊距 | margins | mar() | 畫布上想要畫的地方的邊距 |
外圍邊距 | out margin area | oma() | 畫的圖除了坐標(biāo)軸外的畫的東西 |
我們也可以用mai() and omi() 調(diào)整邊緣,mai()與mar()的區(qū)別主要是單位的不同 ,oma與omi的區(qū)別主要也是是單位的不同
前者單位為文本行數(shù)侠鳄,后者單位為英寸
一嗡害、上面那個圖的代碼,一行行運的話可以深刻體會畫的是哪里
# Margins area 先把邊緣確定
par(oma=c(3,3,3,3)) # all sides have 3 lines of space
par(mar=c(5,4,4,2) + 0.1)
# Plot 畫圖
plot(0:10, 0:10, type="n", xlab="X", ylab="Y") # type="n" hides the points
# Place text in the plot and color everything plot-related red
text(5,5, "Plot", col="red", cex=2)
box(col="red")
# Place text in the margins and label the margins, all in forestgreen
mtext("Margins", side=3, line=2, cex=2, col="forestgreen")
mtext("par(mar=c(b,l,t,r))", side=3, line=1, cex=1, col="forestgreen")
mtext("Line 0", side=3, line=0, adj=1.0, cex=1, col="forestgreen")
mtext("Line 1", side=3, line=1, adj=1.0, cex=1, col="forestgreen")
mtext("Line 2", side=3, line=2, adj=1.0, cex=1, col="forestgreen")
mtext("Line 3", side=3, line=3, adj=1.0, cex=1, col="forestgreen")
box("figure", col="forestgreen")
# Label the outer margin area and color it blue
# Note the 'outer=TRUE' command moves us from the figure margins to the outer margins.
mtext("Outer Margin Area", side=1, line=1, cex=2, col="blue", outer=TRUE)
mtext("par(oma=c(bottom,left,to,right))", side=1, line=2, cex=1, col="blue", outer=TRUE)
mtext("Line 0", side=1, line=0, adj=0.0, cex=1, col="blue", outer=TRUE)
mtext("Line 1", side=1, line=1, adj=0.0, cex=1, col="blue", outer=TRUE)
mtext("Line 2", side=1, line=2, adj=0.0, cex=1, col="blue", outer=TRUE)
box("outer", col="blue")
二畦攘、用其他圖再次示例,先畫一個散點圖
plot(x=expdata[,1],y=expdata[,2], type="p", ann=T, axes=T,cex=0.2,
main = "the compare of two sample's expression")`
box()函數(shù)可可視化plot繪圖區(qū)域
# plot區(qū)域
box("plot", lty="dashed",col="red",lwd=3)
# figure區(qū)域
box("figure",col="blue",lwd=3)
# 繪圖邊距
box("outer", col="darkgreen",lwd=3)