Controlling the spacing of markers in fplot (symbolic variable)
104 views (last 30 days)
Show older comments
Hi. I can't quite figure out how to tell Matlab what number of markers to use on a given plot. I understand that by default it created a marker for each data point, and I've seen a few answers suggesting the use of "scatter()" or mapping a vector of fewer data points of the same function..
Thing is, I'm using symbolic variables, so those options don't work (at least I couldn't get them to). So is there an option that can work?
Basically, when plotting several graphs on the same axes, I just want to mark each continuous plot with a different marker, since I usually print them out in b&w, and sometimes the linspace options aren't enough. But the default marker setting just floods the graph with markers, making a mess. It would be nice to have an option to put like 10 markers on the entire graph.
2 Comments
Karan Gill
on 8 Dec 2016
Yep it could be that markers aren't the way to go. In addition to line styles, you can use colors. Also, it would be useful to see your code.
Answers (1)
Jiro Doke
on 8 Dec 2016
Edited: Jiro Doke
on 8 Dec 2016
How about converting your symbolic variables to numeric just for plotting? Then all those suggestions would work.
Moreover, if you are using R2016b (or newer), you can make use of the new MarkerIndices property of plot.
syms x
y = sin(x);
xd = 0:0.1:10;
yd = double(subs(y,xd));
plot(xd,yd,'o-','MarkerIndices',1:5:length(xd))
0 Comments
See Also
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!