矩形を描く rect() 関数
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
COLOR(red){SIZE(20){矩形を描く rect() 関数}}
([[グラフィックス参考実例集]]に戻る。[[Rのグラフィックス...
矩形を描く rect() 関数は、既存のプロット領域に与えられた...
#contents
~
** 例1。色、ハッチング、枠等をさまざまに変える [#qc6cad03]
## set up the plot region:
op <- par(bg = "thistle")
plot(c(100, 250), c(300, 450), type = "n", xlab="", ylab...
main = "2 x 11 rectangles; 'rect(100+i,300+i, 150+...
i <- 4*(0:10)
## draw rectangles with bottom left (100, 300)+i and top...
rect(100+i, 300+i, 150+i, 380+i, col=rainbow(11, start=....
rect(240-i, 320+i, 250-i, 410+i, col=heat.colors(11), lw...
## Background alternating ( transparent / "bg" ) :
j <- 10*(0:5)
rect(125+j, 360+j, 141+j, 405+j/2, col = c(NA,0), bord...
rect(125+j, 296+j/2, 141+j, 331+j/5, col = c(NA,"midnigh...
mtext("+ 2 x 6 rect(*, col = c(NA,0)) and col = c(NA,\...
par(op)
#ref(矩形を描く rect() 関数/rect1.jpg, left)
** 例2 [#kf4ad76f]
op <- par(bg = "thistle")
## an example showing colouring and shading
plot(c(100, 200), c(300, 450), type= "n", xlab="", ylab=...
rect(100, 300, 125, 350) # transparent
rect(100, 400, 125, 450, col="green", border="blue") # c...
rect(115, 375, 150, 425, col=par("bg"), border="transpar...
rect(150, 300, 175, 350, density=10, border="red")
rect(150, 400, 175, 450, density=30, col="blue",
angle=-30, border="transparent")
legend(180, 450, legend=1:4, fill=c(NA, "green", par("fg...
density=c(NA, NA, 10, 30), angle=c(NA, NA, 30, -3...
par(op)
#ref(矩形を描く rect() 関数/rect2.jpg, left)
** 例3。矩形に影をつける (Ross Ihaka さんの統計数理研究...
中間色を使うことにより見栄えの良い図が得られる。R で使え...
op <- par(bg="LightCyan") # 背景色指定
plot(c(0,100),c(0,100),typ="n",xlab="",ylab="") # 空の作...
xl=c(0,0,0,0,0) # 5 つの矩形の左下隅 x 座標
xr=c(30,60,45,78,59) # 5 つの矩形の右上隅 x 座標
yb=c(10,30,50,70,90)-5 # 5 つの矩形の左下隅 y 座標
yt=yb+15 # 5 つの矩形の右上隅 y 座標
# 以下灰色の矩形を少しづつずらしながら影を描く(rect 関数...
# border 色をやはり灰色にし枠を消す
# 関数 xinch, yinch の使用法に注意(現在の作図領域に合わ...
for (y in (1:4)/100 )
rect(xl+xinch(y), yb-yinch(y),
xr+xinch(y), yt-yinch(y), col="grey", border="gre...
# 最後に本来の矩形を描く(順序が大事、これまでの作図を上...
rect(xl,yb,xr,yt,col="orange",border="orange")
par(op) # グラフィックスオプションを復帰
#ref(矩形を描く rect() 関数/shadebox.jpg, left)
終了行:
COLOR(red){SIZE(20){矩形を描く rect() 関数}}
([[グラフィックス参考実例集]]に戻る。[[Rのグラフィックス...
矩形を描く rect() 関数は、既存のプロット領域に与えられた...
#contents
~
** 例1。色、ハッチング、枠等をさまざまに変える [#qc6cad03]
## set up the plot region:
op <- par(bg = "thistle")
plot(c(100, 250), c(300, 450), type = "n", xlab="", ylab...
main = "2 x 11 rectangles; 'rect(100+i,300+i, 150+...
i <- 4*(0:10)
## draw rectangles with bottom left (100, 300)+i and top...
rect(100+i, 300+i, 150+i, 380+i, col=rainbow(11, start=....
rect(240-i, 320+i, 250-i, 410+i, col=heat.colors(11), lw...
## Background alternating ( transparent / "bg" ) :
j <- 10*(0:5)
rect(125+j, 360+j, 141+j, 405+j/2, col = c(NA,0), bord...
rect(125+j, 296+j/2, 141+j, 331+j/5, col = c(NA,"midnigh...
mtext("+ 2 x 6 rect(*, col = c(NA,0)) and col = c(NA,\...
par(op)
#ref(矩形を描く rect() 関数/rect1.jpg, left)
** 例2 [#kf4ad76f]
op <- par(bg = "thistle")
## an example showing colouring and shading
plot(c(100, 200), c(300, 450), type= "n", xlab="", ylab=...
rect(100, 300, 125, 350) # transparent
rect(100, 400, 125, 450, col="green", border="blue") # c...
rect(115, 375, 150, 425, col=par("bg"), border="transpar...
rect(150, 300, 175, 350, density=10, border="red")
rect(150, 400, 175, 450, density=30, col="blue",
angle=-30, border="transparent")
legend(180, 450, legend=1:4, fill=c(NA, "green", par("fg...
density=c(NA, NA, 10, 30), angle=c(NA, NA, 30, -3...
par(op)
#ref(矩形を描く rect() 関数/rect2.jpg, left)
** 例3。矩形に影をつける (Ross Ihaka さんの統計数理研究...
中間色を使うことにより見栄えの良い図が得られる。R で使え...
op <- par(bg="LightCyan") # 背景色指定
plot(c(0,100),c(0,100),typ="n",xlab="",ylab="") # 空の作...
xl=c(0,0,0,0,0) # 5 つの矩形の左下隅 x 座標
xr=c(30,60,45,78,59) # 5 つの矩形の右上隅 x 座標
yb=c(10,30,50,70,90)-5 # 5 つの矩形の左下隅 y 座標
yt=yb+15 # 5 つの矩形の右上隅 y 座標
# 以下灰色の矩形を少しづつずらしながら影を描く(rect 関数...
# border 色をやはり灰色にし枠を消す
# 関数 xinch, yinch の使用法に注意(現在の作図領域に合わ...
for (y in (1:4)/100 )
rect(xl+xinch(y), yb-yinch(y),
xr+xinch(y), yt-yinch(y), col="grey", border="gre...
# 最後に本来の矩形を描く(順序が大事、これまでの作図を上...
rect(xl,yb,xr,yt,col="orange",border="orange")
par(op) # グラフィックスオプションを復帰
#ref(矩形を描く rect() 関数/shadebox.jpg, left)
ページ名: