ハート型のランダム ポイントのテッセレーションを生成しています。プロット内のピクセルの色を制御する方法を理解するのに苦労しています。(この例ではplot(tess)
) イメージ値のプロットが生成されるため、カラー ランプで同じ数の色を指定するだけでそれらを制御できると考えましたが、そうではありません。
library(spatstat)
t <- seq(from = 2*pi, to = 0.001, length.out = 1500)
x <- 16*sin(t)**3
y <- 13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t) #heart equation taken from wolfram http://mathworld.wolfram.com/HeartCurve.html.
heart_win <- owin(poly = cbind(x,y)) #note - not self enclosed
#random sample of points within heart
points <- rpoint(100, win = heart_win)
tess <- dirichlet(points)
plot(tess, main = ' ')
#color for 100 values
norm_palette <- colorRampPalette(c("white","red"))
plot(tess, main = ' ', col=norm_palette(100), valuesAreColours = FALSE)
これにより、以下の画像が生成されます。
はい、私はその日まで彼の妻をバレンタインデーの贈り物にしない男です(私を判断しないでください)!