Make certain plot markers invisible?

23 views (last 30 days)
set(0,'DefaultLineMarkerSize',6);
plot(x,y,'red.-');
I have some points touching the x-axis (y-value is 0). For these particular points, I want to make the markers invisible.
Also, I want all the points to be plotted. So plot(x,y(y>0),'red.-'); where x is modified earlier in the script to have the same vector length as y(y>0) wouldn't work.
Any help is appreciated. Thanks!

Accepted Answer

Walter Roberson
Walter Roberson on 13 Jun 2013
You cannot modify individual markers of a line() or lineseries() object such as are created by line() or plot().
What you can do is plot() without the markers and the scatter() the markers into place. Or you can plot() without the markers and the plot() again with
hold on; plot(x(y>0), y(y>0), 'r.')
which would plot only markers at those locations, with no lines.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!