Animated X, Y scatter plot
18 views (last 30 days)
Show older comments
Jayant chouragade
on 19 Jul 2020
Commented: Bjorn Gustavsson
on 19 Jul 2020
Hi,
I have three variable X, Y, Z of length 10000 points each .Z represent signal strength. I need to generate animated X,Y plot (scatter) with signal strength represented by color. In general scenerio I clould use method given in below link.
However I would like the followings:
- Instead of adding single point in each loop I would like to add 10 points in each loop.
- Change the color of all old points to 'White' in each loop iteration.
- Represent thenew 10 points being added in current loop by respective colors using there signal strength given in Z. Lets say Z is a number from between -1 to 1, then Z=-1 should represent start color of colormap 'jet' and Z=1 should be last color of colormap 'jet'.
How do we acheive it.
thanks
jayant
0 Comments
Accepted Answer
Bjorn Gustavsson
on 19 Jul 2020
Have you tried to look at scatter? That should let you do this simply like this:
for i1 = 1:10:(numpoints-10),
plot(xP(1:i1-1),yP(1:i1-1),'w.','markersize',18)
hold on
scatter(xP(i1+(0:9)),yP(i1+(0:9)),32,zP(i1+(0:9)),'filled')
axis([xMin, xMax, yMin, yMax])
caxis([zMin, zMax])
drawnow
end
HTH
2 Comments
Bjorn Gustavsson
on 19 Jul 2020
Sorry about that, forgot to add in a hold off at the end of the loop.
Regarding your movie-making:
1, frame_Rate=10000; - this would give you a video for 10000 frames per second, this is to high for our human visual perception. Try with something in the range of 10 - 60, depending on how much of each frame you want the audience to see.
2, (Num_of_frames should rather be the numpoints/312, than the number you set it to.)
3, Perhaps try getframe(gfc) or getframe(gca). Also if you modify the size of the figure-window during the processing things go kaboom.
More later.
More Answers (0)
See Also
Categories
Find more on Animation 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!