MATLAB 绘图的 MarkerIndices 属性 [英] MATLAB plot's MarkerIndices property
本文介绍了MATLAB 绘图的 MarkerIndices 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将 MarkerIndices
与 plot
一起使用?
How can I use MarkerIndices
with plot
?
x = linspace(-10,10,101);
y = sin(x);
plot(x, y, 'color', 'blue', ...
'LineStyle','-', ...
'Marker', 's', ...
'MarkerIndices', [1, 5, 10], ...
'MarkerEdgeColor', 'black',...
'MarkerFaceColor','yellow');
错误信息
Error using plot
There is no MarkerIndices property on the Line class.
Error in plotting3 (line 4)
plot(x, y, 'color', 'blue', ...
推荐答案
MarkerIndices
在 R2016b 版本中可用.
解决方法是绘制两次:
MarkerIndices = [1, 5, 10];
myplot = plot(x, y, 'b-.');
hold on;
mymarkers = plot(x(MarkerIndices), y(MarkerIndices), 'ro');
legend(myplot)
这应该有效.我评论说这是参考 MathWorks 社区上的帖子.找到的话会提供链接.
This should work. I commented that this is in reference to a post on MathWorks Community. Will provide a link if found it.
附言这是 LINK 到答案;
P.S. This is the LINK to the answer;
这篇关于MATLAB 绘图的 MarkerIndices 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文