How to remove markers of a plot

212 views (last 30 days)
Rahman Amin
Rahman Amin on 13 Jan 2020
Commented: Adam Danz on 6 Feb 2020
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 Comment
Adam Danz
Adam Danz on 6 Feb 2020
Edited: Adam Danz on 6 Feb 2020
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).

Sign in to comment.

Answers (1)

Subhadeep Koley
Subhadeep Koley on 16 Jan 2020
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 Comments
Rahman Amin
Rahman Amin on 16 Jan 2020
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 on 6 Feb 2020
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.

Sign in to comment.

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!