3次å ã®ãã¼ã¿ãã°ã©ãã«ãã
3次å ã®ãã¯ãã«ã§è¡¨ããããã¼ã¿ãã°ã©ãåããæ¹æ³ã«ã¤ãã¦ï¼ããã¤ãã¾ã¨ãã¦ã¿ã¾ããï¼
使ç¨ãããã¼ã¿
volcano
Rã«çµã¿è¾¼ã¾ãã¦ãããã¼ã¿ã»ããã§ï¼Maunga Whauå±±ã®æ¨é«ãã¼ã¿ã ããã§ãï¼10m * 10mã®ã°ãªããã§ï¼87rowã¨61columnãããªãã¾ãï¼rowã¯æ±ãã西ã¸ï¼columnã¯åããåã¸ã®ã©ã¤ã³ã¨å¯¾å¿ãã¦ããï¼æå°å¤ã¯94ï¼æ大å¤ã¯195ã§ãï¼ã¾ãã¯ãã¼ã¿ã»ããã®æºåï¼
# ãããããããã¼ã¿ã®ã©ãã«ãä½æ EastWest <- 1:nrow(volcano) * 10 # rowã®æ°ã¯87 SouthNorth <- 1:ncol(volcano) * 10 # columnã®æ°ã¯61 # é ä¸ã®ä½ç½®ãå¤æ°ã«å ¥ãã¦ãã mountaintop <- which(volcano == max(volcano), arr.ind = TRUE) * 10
ã°ã©ããæã
image
å¤ã«å¿ããè²ãæ ¼åä¸ã«ç¤ºãé¢æ°ã§ãï¼
主è¦ãªå¼æ°ã¯ä»¥ä¸ã®ã¨ããï¼
x, y: ãããããããzã®ä½ç½®ã表ã座æ¨ï¼æé ã§ãªããã°ãªããªãï¼
z: ãããããããå¤ã®matrixï¼NAå¤ã許ãããï¼
col: ãããããããå¤ã«ã¤ããè²ï¼
åè
xã¯nrow(z)+1ãnrow(z)ã¨çãããªãå¿
è¦ãããï¼åè
ãªãã»ã«ã®å¢çã«ï¼å¾è
ãªãã»ã«ã®midpointã«ï¼å¤ããããããããï¼
NAå¤ã¯éæã«ãªãï¼
zã®matrixã¯f(x[i], y[i])ã®tableã¨ãã¦è§£éãããï¼ãã£ã¦ï¼xã¯rowã®æ°ã«ï¼yã¯columnã®æ°ã«ï¼å¯¾å¿ãã¦ããå¿
è¦ãããï¼ã¤ã¾ãï¼ãã¼ã¿ã»ããã¨ã°ã©ãã¯90度å転ããé¢ä¿ã«ããã¨ãããã¨ã§ããï¼
å®ä¾
image(EastWest, SouthNorth, volcano, col = heat.colors(100)) # col ã®å¤ã«ã¯ä»ã«ãããªã®ãããã¾ãï¼ # rainbow(7), heat.colors(10), topo.colors(100), terrain.colors(100), gray((0:100)/100), gray((100:0)/100) # ã¤ã¥ãã¦é ä¸ã®ä½ç½®ã«ãããããç½®ãã¾ã points(mountaintop[1], mountaintop[2], pch = 20, col = "blue") # çé«ç·ãæãcontouré¢æ°ãåæãã¦ã¿ã¾ãããï¼ä»åã¯æ¨é«175mã®ä½ç½®ã«ï¼ contour(EastWest, SouthNorth, volcano, levels = 175, add = TRUE) # levels = seq(90, 200, by = 5) ãªã©ãã§ãã¾ãï¼
以ä¸ã®ãããªã°ã©ããæãã¾ãï¼
persp
x-yå¹³é¢ã«é è¿å³ãæãé¢æ°ã§ãï¼ä¸»è¦ãªå¼æ°
x, y: ãããããããzã®ä½ç½®ã表ã座æ¨ï¼æé ã§ãªããã°ãªããªãï¼
z: ãããããããå¤ã®matrixï¼NAå¤ã許ãããï¼
col: ãããããããå¤ã«ã¤ããè²ï¼
theta, phi: è¦åº§ã®è§åº¦ï¼åè
ã¯æ¨ªåãã®å転ï¼å¾è
ã¯ç¸¦åãã®å転ï¼
r: è¦éã¨ããããã®è·é¢ï¼
d: é è¿æã®å¼·ãï¼1以ä¸ãªãé è¿æãå¼±ã¾ãï¼1以ä¸ãªã強調ãããï¼
scale: FALSEãªãï¼å
¨è»¸å
±éã®ã¹ã±ã¼ãªã³ã°ããªãããï¼
border: 表é¢ã«æãããç·ã®è²ï¼NAãªãç·ãæããªãï¼
ltheta, lphi: æå®ããå¤ã®è¦åº§ããå
ãæå½±ããããããªé°ãã¤ãï¼
shade: é°ãã¤ãï¼1ã«è¿ãã»ã©æ¿ãé°ã«ãªãï¼
ticktype: "detailed"ãªã軸ã«ã¹ã±ã¼ã«ããããããããï¼ããã©ã«ãã§ã¯"simple"ï¼
nticks: ã¹ã±ã¼ã«ã®æ°ãæå®ï¼
å®ä¾
ããã§ã¯ç¹ã«ï¼2次å
ã®ã°ã©ãã«ä½¿ãããé¢æ°ã3次å
ã®ã°ã©ãã«æãtrans3dé¢æ°ã使ã£ã¦ï¼ç¹ãç·ã追å ãã¦ã¿ã¾ãï¼
mtMaugnaWau <- persp(EastWest, SouthNorth, volcano, theta = 25, phi = 30, scale = FALSE, col = "green", border = NA, ltheta = 120, shade = 0.7, ticktype = "detailed", cex.axis = 0.8) # é ä¸ã®è¿½å points(trans3d(mountaintop[1], mountaintop[2], max(volcano), pmat = mtMaugnaWau), col = "red", pch = 16) # é ä¸ããæ¨é«150mã©ã¤ã³ã«ããä¸ç¹ã«ç´ç·ãå¼ã level150 <- which(volcano == 150, arr.ind = TRUE) * 10 x <- 6 # 150mã©ã¤ã³ã®ãã¡ã®ã©ã®ç¹ã«ç´ç·ãå¼ããï¼é©å½ã«æ±ºãã¦6ã«ãã¾ããï¼ lines(trans3d(c(mountaintop[1], level150[x, 1]), c(mountaintop[2], level150[x, 2]), c(max(volcano), 150), pmat = mtMaugnaWau), col = "blue")
以ä¸ã®ãããªã°ã©ããæãã¾ãï¼
scatterplot3d
å¤ã3次å ã«ããããããé¢æ°ã§ãï¼CRANããããã±ã¼ã¸ã®ãã¦ã³ãã¼ããå¿ è¦ã§ãï¼scatterplot3d: 3D Scatter Plot
主è¦ãªå¼æ°
x, y, x: ããããã®åº§æ¨ï¼
scale.y: y軸ã®ã¹ã±ã¼ã« (奥è¡ã) ã®èª¿ç¯ï¼
angle: x-y軸ã®è§åº¦
highlight.3d: TRUEãªãï¼y軸ã®å¤ã«å¿ãã¦è²ã®æ¿ããå¤ããï¼
å®ä¾
# ãã¼ã¿ã»ããã®æºåï¼ EastWest3d <- rep(EastWest, length(SouthNorth)) SouthNorth3d <- vector(length = 87 * 61) for(i in 1:61){ SouthNorth3d[((i - 1) * 87 + 1):(i * 87)] <- SouthNorth[i] } # ããããã®å®è¡ï¼ library(scatterplot3d) # ããã±ã¼ã¸ã®å¼ã³åºãï¼ mtMaugnaWau3d <- scatterplot3d(EastWest3d, SouthNorth3d, volcano, scale.y = 0.5, highlight.3d = TRUE) # plane3dã¡ã½ãããpoints3dã¡ã½ããã§å¹³é¢ãç¹ã®è¿½å ãå¯è½ã§ãï¼ # æ¨é«150mã©ã¤ã³ã«å¹³é¢ã®è¿½å ï¼ mtMaugnaWau3d$plane3d(150, x.coef = 0, y.coef = 0, lty.box = "dashed") # é ä¸ã®è¿½å ï¼ mtMaugnaWau3d$points3d(mountaintop[1], mountaintop[2], max(volcano), col = "blue", pch = 19)
以ä¸ã®ãããªã°ã©ããæãã¾ãï¼
ã©ããªã¨ãã«ä½¿ãã
ã¾ãï¼é£ç¶çãªå¤ãã¹ãã¼ã£ã¨é¢ã§æãããã¨ãã«ã¯ï¼imageãperspãé©ãã¦ããã§ãããï¼imageã¯ç´æçã«ã¤ã¡ã¼ã¸ãã¤ãã¿ã«ããã§ããï¼å ¨ä½ãè¦æ¸¡ããã®ã§ï¼ã²ã¨ã¤ã²ã¨ã¤ã®å¤ãããç¨åº¦ãã¡ãã¨æ¤è¨¼ã§ãã¾ãï¼ä¸æ¹ï¼perspã¯ç´æçã«ã¤ã¡ã¼ã¸ãã¤ããã¾ããï¼å±±ãè°·ã§è¦ããªããªãé¨åãããï¼ãã¼ã¿ããã¹ã¦è¦ããããªãããããã¾ããï¼æ¬¡ã«ï¼ç·ã»ç¹ãªã©ï¼é¢ã«æ¯ã¹ãã¨ã¨ã³ã¨ã³ã«ãªãå¤ã3次å ã«ãããããããã¨ãã¯ï¼scatterplot3dé¢æ°ãé©ãã¦ããã§ãããï¼å¼æ°ãå å®ãã¦ããï¼ã©ãã«ãã¹ã±ã¼ã«ãªã©ããã¡ãã¨æããã¨ãã§ãã¾ãï¼
â» ä»ã«ããããªé¢æ°ãããï¼ãªã©ãåãã§ãããï¼ãã²ãã©ãã¯ããã¯ãªã©ã§ãæãããã ããã°å¹¸ãã§ãï¼