How to remove markers of a plot
조회 수: 56 (최근 30일)
이전 댓글 표시
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
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
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
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 Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!