グラフィックス参考実例集:鳥瞰図
の編集
http://www.okadajp.org/RWiki/?%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%E3%82%B9%E5%8F%82%E8%80%83%E5%AE%9F%E4%BE%8B%E9%9B%86%EF%BC%9A%E9%B3%A5%E7%9E%B0%E5%9B%B3
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
(no template pages)
COLOR(red){SIZE(20){グラフィックス参考実例集:鳥瞰図 persp}}~ ([[グラフィックス参考実例集]]に戻る。[[Rのグラフィックスパラメータ]]を参照する。)~ persp() 関数は二次元曲面の鳥瞰図を描く。[[ヒストグラムと密度の推定]] にも実例あり。 #contents ~ ** 曲面の色調を与える関数 (r-help 記事より 2003.12.28) [#t9b2555b] ~ Function to generate a matrix of colors to be used in perspective plots (based on demo(persp) and the comments of U. Ligges surf.colors <- function(x, col = terrain.colors(20)) { # First we drop the 'borders' and average the facet corners # we need (nx - 1)(ny - 1) facet colours! x.avg <- (x[-1, -1] + x[-1, -(ncol(x) - 1)] + x[-(nrow(x) -1), -1] + x[-(nrow(x) -1), -(ncol(x) - 1)]) / 4 # Now we construct the actual colours matrix colors = col[cut(x.avg, breaks = length(col), include.lowest = T)] return(colors) } # Now lets look at an example of using it: # first lets build some random surface library(MASS) x <- cbind(rnorm(100), rnorm(100)) x <- kde2d(x[,1], x[,2], n = 100)$z # now lets plot it! par(bg = "gray") persp(x, col = surf.colors(x), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors1.png, left) persp(x, col = surf.colors(x, col = heat.colors(40)), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors2.png, left) persp(x, col = surf.colors(x, col = topo.colors(40)), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors3.png, left) persp(x, col = surf.colors(x, col = gray(seq(0, 1, len = 40))), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors4.png, left)
タイムスタンプを変更しない
COLOR(red){SIZE(20){グラフィックス参考実例集:鳥瞰図 persp}}~ ([[グラフィックス参考実例集]]に戻る。[[Rのグラフィックスパラメータ]]を参照する。)~ persp() 関数は二次元曲面の鳥瞰図を描く。[[ヒストグラムと密度の推定]] にも実例あり。 #contents ~ ** 曲面の色調を与える関数 (r-help 記事より 2003.12.28) [#t9b2555b] ~ Function to generate a matrix of colors to be used in perspective plots (based on demo(persp) and the comments of U. Ligges surf.colors <- function(x, col = terrain.colors(20)) { # First we drop the 'borders' and average the facet corners # we need (nx - 1)(ny - 1) facet colours! x.avg <- (x[-1, -1] + x[-1, -(ncol(x) - 1)] + x[-(nrow(x) -1), -1] + x[-(nrow(x) -1), -(ncol(x) - 1)]) / 4 # Now we construct the actual colours matrix colors = col[cut(x.avg, breaks = length(col), include.lowest = T)] return(colors) } # Now lets look at an example of using it: # first lets build some random surface library(MASS) x <- cbind(rnorm(100), rnorm(100)) x <- kde2d(x[,1], x[,2], n = 100)$z # now lets plot it! par(bg = "gray") persp(x, col = surf.colors(x), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors1.png, left) persp(x, col = surf.colors(x, col = heat.colors(40)), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors2.png, left) persp(x, col = surf.colors(x, col = topo.colors(40)), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors3.png, left) persp(x, col = surf.colors(x, col = gray(seq(0, 1, len = 40))), phi = 30, theta = 225, box = F, border = NA, shade = .4) #ref(グラフィックス参考実例集:鳥瞰図/surfcolors4.png, left)
テキスト整形のルールを表示する
添付ファイル:
surfcolors1.png
2877件
[
詳細
]
surfcolors4.png
2561件
[
詳細
]
surfcolors3.png
2445件
[
詳細
]
surfcolors2.png
2540件
[
詳細
]