Fast way to plot points with different colors
92 views (last 30 days)
Show older comments
Commented: Edward on 29 Sep 2013
Hi, i have a matrix in the form
where r,g,b are the colors for each data point.
currently I have been plotting using:
for a=1:length(colorData(:,1)) %for every row
color = [colorData(a,3),colorData(a,4),colorData(a,5)];
which works but takes about 3 seconds to execute for the large matrices im using. I can plot the x,y data in about 100ms so the problem is not really how much data im using.
Surely there must be a quicker, more efficient way to do this?
Image Analyst on 29 Sep 2013
Try using scatter() instead of that loop. With scatter() you can pass in colorData so that each marker has the color you specify.
More Answers (0)
Find more on Annotations 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!