Azzera filtri
Azzera filtri

A question on Scatter PLot ???

1 visualizzazione (ultimi 30 giorni)
A P S
A P S il 26 Ago 2016
Risposto: Azzi Abdelmalek il 26 Ago 2016
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)

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 26 Ago 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

Più risposte (0)

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by