Controlling the spacing of markers in fplot (symbolic variable)

104 次查看(过去 30 天)
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 个评论
Chaya N
Chaya N 2016-12-8
编辑:Chaya N 2016-12-8
May I suggest plotting the graphs with different line styles and widths instead? You could do solid, dotted, dashed lines etc.
Karan Gill
Karan Gill 2016-12-8
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.

请先登录,再进行评论。

回答(1 个)

Jiro Doke
Jiro Doke 2016-12-8
编辑:Jiro Doke 2016-12-8
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))

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by