I have a dataset with 3 vectors X, Y, and Z and I want to plot a 2D image from this dataset. I don't know how to define X, Y and Z and the color represent by different Z. Do you have any idea how to do this task?
Thanks in advance
I have a dataset with 3 vectors X, Y, and Z and I want to plot a 2D image from this dataset. I don't know how to define X, Y and Z and the color represent by different Z. Do you have any idea how to do this task?
Thanks in advance
This will be a bit slow if there are thousands of points but should work:
>> x=1:10;
>> y=x.^2;
>> z=y/10;
>> cmap = jet(64); % Define a color map
>> idx = ceil(z/max(z)*64); % Indices into the map
>> figure
>> hold on
>> for i=1:length(x);plot(x(i),y(i),'o','Color',cmap(idx(i),:));end
I do like the suggestions in Plot (x,y,z) triplets over coordinates (x,y) with color z though