Azzera filtri
Azzera filtri

How to change only the LineStyle of the top curve?

2 visualizzazioni (ultimi 30 giorni)
Mohammad
Mohammad il 17 Dic 2019
Modificato: Adam Danz il 18 Dic 2019
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', '-.')

Risposte (1)

Adam Danz
Adam Danz il 17 Dic 2019
Modificato: Adam Danz il 18 Dic 2019
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', '-.')

Categorie

Scopri di più su Colormaps in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by