필터 지우기
필터 지우기

How to change only the LineStyle of the top curve?

조회 수: 2 (최근 30일)
Mohammad
Mohammad 2019년 12월 17일
편집: Adam Danz 2019년 12월 18일
I'm trying the following code (Mathworks example) but I only want the LineStyle of top curves to be as specified (like the attached figure). Also I want the xaxis strats from 0 instead of 1.
Y = [1, 5, 3;
3, 2, 7;
1, 5, 3;
2, 6, 1];
figure
area(Y, 'Linewidth', 2, 'LineStyle', '-.')

답변 (1개)

Adam Danz
Adam Danz 2019년 12월 17일
편집: Adam Danz 2019년 12월 18일
Here are two options with slightly different outcomes.
Option 1
Modify the upper line only
Y = [1, 5, 3;
3, 2, 7;
1, 5, 3;
2, 6, 1];
figure()
area(Y)
hold on
plot(sum(Y,2),'Linewidth', 2, 'LineStyle', '-.')
Option 2
Modify the line that surrounds the entire outline of the upper area object.
Y = [1, 5, 3;
3, 2, 7;
1, 5, 3;
2, 6, 1];
figure()
h = area(Y); % get the area object handles
set(h(3), 'Linewidth', 2, 'LineStyle', '-.')

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by