set color for scatter plot
古いコメントを表示
How can I set the colors according to the Z value a scatter plot?
Here p2dZ is either 0, 1 or 2. I want an scatter plot where horizontal and vertical coordinate values are as given in pdX and pdY vectors, translated into p2dX and p2dY via meshgrid. But the value at each point comes from the vector p2dZ which is either 0, 1, or 2. However, I want the colors of the points to be set according to the value p2dZ.
how can I set the color in "scatter3(x,y,z,sz,c,'filled')" so the values match the pdZZ which is the 1 dimentional version of p2dZZ?
I don't want to use "imagesc(p2dZZ);colorbar;" as I want to see individual points.
pdX = 1:12;
pdY = 20:-1:1;
[p2dX,p2dY] = meshgrid(pdX, pdY);
p2dZ = round(2*rand(size(p2dX)));
pdXX = p2dX(:)';
pdYY = p2dY(:)';
pdZZ = p2dZ(:)';
scatter3(pdXX, pdYY, pdZZ, 5,'filled');
view(0,90);

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!