필터 지우기
필터 지우기

changing the legend line style (":","-","--","-.") for 4 black lines in plot instead of using multip colour

조회 수: 9 (최근 30일)
NOUFA
NOUFA 2022년 7월 2일
댓글: NOUFA 2022년 10월 11일
What should i add to appear the different black line style
figure;
plot([1:M]/M,u,'DisplayName','M='+string(M),'LineWidth',1); hold on;
xlabel('i/M','FontWeight','bold','FontSize',12);
ylabel('U','FontWeight','bold','FontSize',12);
lgd=legend;
lgd.NumColumns = 1;
lgd.FontSize = 12;
ax = gca;
ax.XAxis.FontWeight = 'bold';
ax.YAxis.FontWeight = 'bold';

답변 (1개)

Jan
Jan 2022년 7월 2일
figure;
axes('NextPlot', 'add', ...
'LineStyleOrder', cellstr([":", "-", "--", "-."]), ...
'ColorOrder', zeros(1, 3));
plot(rand(10, 4))
legend

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by