How can I give different colors to each x, y and z coordinate points?

2 views (last 30 days)
i want to give diffrent colors to x ,y and z data , lets x data to be blue color, y to be green and z to be red .
I am attaching my code.
% x coordinate data
temp1=350:390;
% y coordinate data
rad1=.001:.001:.02;
% z coordinate data (for this i have attached PPDF.csv file.)
test = csvread('PPDF.csv');
% x=test(:,1);
% y=test(:,2);
% z=test(:,3);
[r, t] = meshgrid(rad1, temp1);
figure
scatter3(t(:), r(:), test(:),'filled')
colormap jet

Accepted Answer

DGM
DGM on 17 Apr 2022
You'll have to figure out how you want to rescale the data to fit standard data range for a color table, but you can do something like this:
% x coordinate data
temp1=350:390;
% y coordinate data
rad1=.001:.001:.02;
% z coordinate data (for this i have attached PPDF.csv file.)
test = csvread('PPDF.csv');
[r, t] = meshgrid(rad1, temp1);
% create some sort of color map
cmap = [rescale(test(:)),rescale(r(:)),rescale(t(:))];
scatter3(t(:), r(:), test(:),10,cmap,'filled')

More Answers (0)

Categories

Find more on Model Import in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!