How to retrieve multiple handles from plot function?
Show older comments
Hello,
I'm trying to plot some points in a figure and need to change the color of the points during the different iterations of the algorithm.
My points are stored in a two-dimensional vector, when I plot it the following way, everything works as expected: handle = plot( p(1 ,1), p(1 ,2), 'o', ..., p(n,1), p(n,2), 'o');
I can then set the color of the point by using: set(handle(1) ,'MarkerEdgeColor','r','MarkerFaceColor','r'); and so on...
This is working as expected, I can change the color of each individual point, so some points can be red others green and so on.
My problem is, the number of points are not always the same. So instead of using the plot command with every point I tried to use: handle = plot( p(:,1), p(:,2), 'o');
However, this way only one handle is returned, all points will have the same color and I can't change the color later on in the code.
Is there any way to plot a unknown number of points as above and still get handles which I can use to set color?
I'm using Matlab 2012a.
Best Regards, Stephan
Accepted Answer
More Answers (0)
Categories
Find more on Line 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!