A question on Scatter PLot ???
1 view (last 30 days)
Show older comments
Hello Everyone ,
I have two arrays of each [10000x2] size. First Column of Data is X-Axis and Second Column is Y-Axis. Same goes with the Second Array too. I need to have a moving scatter plot. i.e I need to see the Data being plotted ,point by point. I tried using for loop and plot point by point for a single graph But it hangs .... Finally I found an answer from mathworks guy who posted a solution. It did worked and I need to do a workaround to that solution so that I can plot two arrays like same. *************************************************
V1 = rand(1,10000);
V2 = rand(1,10000);
N = NaN([1,10000]);
h = scatter(N, N , 'r*');
xdata1 = get(h, 'XData');
ydata1 = get(h, 'YData');
for lk = 1:10000
xdata1(lk) = V1(lk,1);
ydata1(lk) = V1(lk,2);
% Update the plot
set(h, 'XData', xdata1, 'YData', ydata1);
drawnow
end
***************************************************
If you execute this code, you will be seeing some points being plotted one-by -one.. Now I need the V2 plot on the same figure with different color marker.. like for black asterisk 'k*' .. I am not sure how to workaround by having a same figure handle with two different markers... Do u have any suggestions. ?
This is for analyzing the GPS location tracks .. So need it it MATLAB instead of Google Earth(KML)
0 Comments
Accepted Answer
Azzi Abdelmalek
on 26 Aug 2016
V1 = [1:10000;rand(1,10000)];
V2 = [1:10000;rand(1,10000)];
h = scatter(N, N , 'r*');
for lk = 1:10000
scatter(V1(1,lk),V1(2,lk),'markerfacecolor',[1 0 1])
hold on
scatter(V1(1,lk),V2(2,lk),'markerfacecolor',[1 1 0])
drawnow
end
hold off
0 Comments
More Answers (0)
See Also
Categories
Find more on Scatter Plots 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!