Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
R スクリプトで plot3d 関数を使用して 3D プロットを作成しています。4 次元を追加したいと思います。それは色になります。これどうやってするの?
具体的には、次のコードがあるとします。
plot3d(x, y, z, col=cols, size=2, type='s')
cols4 番目の次元として機能する値のベクトルに基づいて、どのように入力しますか。
cols
カラーマップを作成し、c 変数のカット バージョンを使用してそれにインデックスを付けるだけです。
x = rnorm(100) y = rnorm(100) z = rnorm(100) c = z c = cut(c, breaks=64) cols = rainbow(64)[as.numeric(c)] plot3d(x,y,z,col=cols)