A question on Scatter PLot ???

조회 수: 1 (최근 30일)
A P S
A P S 2016년 8월 26일
답변: Azzi Abdelmalek 2016년 8월 26일
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)

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 26일
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개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by