フィルターのクリア

Help me with plotting 3d scatter

1 回表示 (過去 30 日間)
Darshan Baral
Darshan Baral 2014 年 5 月 3 日
回答済み: Image Analyst 2014 年 5 月 3 日
I'm trying to plot a 3D scatter using data from a CSV. The CSV has column fo x,y, and z as well as other attributes. How do I define the color of the points based on other attributes.

採用された回答

Image Analyst
Image Analyst 2014 年 5 月 3 日
The 5th and last input argument is a list of the colors for each data point. If you have N data points, then the colors is an N by 3 list of RGB values in the range 0-1. You can set their color based on certain other attributes. For example if you want them all red except for where the "value" array is more than 1000, you can do
myColors = [ones(N,1), zeros(N,1), zeros(N, 1)]; % Initialize all red.
for k = 1 : N
if value(k) > 1000
myColors(k, :) = [0,0,1]; % This row will be blue.
end
end
It could be vectorized if you want.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by