How to remove markers of a plot

57 次查看(过去 30 天)
Rahman Amin
Rahman Amin 2020-1-13
评论: Adam Danz 2020-2-6
I have a 2D plot, attached as an image and would ask how to remove the triangle, x etc. markers on my curves. The code is also here:
yyaxis left
ax=gca;
ax.YColor='k';
plot(t,a_res_pool,'Color','[0.3 0 1]','LineWidth',2)
grid on;
grid minor;
title('pool, chest and belt 45°');
xlabel ('time [s]');
ylabel ('acceleration [g]');
hold on
plot(t,a_res_chest,'r','LineWidth',2);
plot(t,pool_a_x,'c','LineWidth',2);
plot(t,pool_a_y,'Color','[0 0.2 0.5]','LineWidth',2,'LineStyle','-');
plot(t,pool_a_z,'Color','[0.1 1 0]','LineWidth',2,'LineStyle','-');
plot(t,chest_a_x,'Color','[1 0.5 0]','LineWidth',2,'LineStyle','-');
plot(t,chest_a_y,'Color','[1 0 1]','LineWidth',2,'LineStyle','-');
plot(t,chest_a_z,'y','LineWidth',2,'LineStyle','-');
  1 个评论
Adam Danz
Adam Danz 2020-2-6
编辑:Adam Danz 2020-2-6
It's not clear to me why the markers are appearing in the first place based on this code. These plot commands should not produce any markers. When is substitute values in for your variables and produce these plots, no markers appear (nor should they, because you hvaen't defined a marker type).

请先登录,再进行评论。

回答(1 个)

Subhadeep Koley
Subhadeep Koley 2020-1-16
HI, you can use the Marker Name-Value Pair of the function plot to specify the marker type. If you specify 'none', then no marker will be used. Refer the code below.
yyaxis left
ax=gca;
ax.YColor='k';
plot(t, a_res_pool, 'Color', '[0.3 0 1]', 'LineWidth', 2, 'LineStyle', '-', 'Marker', 'none')
grid on;
grid minor;
title('pool, chest and belt 45°');
xlabel ('time [s]');
ylabel ('acceleration [g]');
hold on;
plot(t, a_res_chest, 'r', 'LineWidth', 2, 'LineStyle', '-', 'Marker', 'none');
plot(t, pool_a_x, 'c', 'LineWidth', 2, 'LineStyle','-', 'Marker', 'none');
plot(t, pool_a_y, 'Color', '[0 0.2 0.5]', 'LineWidth',2, 'LineStyle','-', 'Marker', 'none');
plot(t, pool_a_z, 'Color', '[0.1 1 0]', 'LineWidth',2, 'LineStyle','-', 'Marker', 'none');
plot(t, chest_a_x, 'Color', '[1 0.5 0]', 'LineWidth',2, 'LineStyle','-', 'Marker', 'none');
plot(t, chest_a_y, 'Color', '[1 0 1]', 'LineWidth',2, 'LineStyle','-', 'Marker', 'none');
plot(t, chest_a_z, 'y', 'LineWidth', 2, 'LineStyle', '-', 'Marker', 'none');
Hope this helps!
  2 个评论
Rahman Amin
Rahman Amin 2020-1-16
thx for the response, the problem was fixed alreasy by declaring '-' at the after the colour.
Somehow 'Marker','none' didn't work...
Adam Danz
Adam Danz 2020-2-6
Setting Marker to none as Subhadeep Koley demonstrated should have worked (it should have resulted in no markers). But the simpler solution is to just set the line properties and not set any marker properties as the code does in your question.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by