Plot points (x,y) and use a third (z) as the color code in Matlab
10,634
Depending on what kind of color map you are looking for, you can try something like
zmin=min(Z);
zmax=max(Z);
map=colormap;
color_steps=size(map,1);
hold on
for i=1:color_steps
ind=find(Z<zmin+i*(zmax-zmin)/color_steps & Z>=zmin+(i-1)*(zmax-zmin)/color_steps);
plot(X(ind),Y(ind),'o','Color',map(i,:));
end
The finding is a little expensive but it seems to be quicker than scatter
. I'm sure you could optimize this further.
Related videos on Youtube
Author by
Oliver Amundsen
Updated on September 15, 2022Comments
-
Oliver Amundsen over 1 year
Possible Duplicate:
matlab: scatter plots with high number of datapointsI have 3 vectors of 315,000 elements each. X,Y, and Z. X & Y are coordinates and Z is a value. I must plot the coordinates as points in a 2D graph, the Z is a color indicator at each coordinate of X and Y. I've tried the "scatter" command, but it extremely slow. Would anybody suggest a better way?
thanks!
-
Oliver Amundsen over 11 yearsI'm trying to plot the elements as points.... but thanks for the comment. I'll update the question