How can I create a shaded plot like the figure sample shown here?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
juan sanchez
il 6 Ott 2021
Commentato: Star Strider
il 6 Ott 2021
How can I create a shaded plot like the figure sample shown here? They are to delineate one zone in darker grey and another one in lighter grey. Please provide sample code if possible.
0 Commenti
Risposta accettata
Star Strider
il 6 Ott 2021
x = linspace(70, 130, 12);
y = rand(2, numel(x));
figure
plot(x, y)
grid
hold on
patch([85 105 105 85], [[1 1]*min(ylim) [1 1]*max(ylim)], [1 1 1]*0.8, 'FaceAlpha',0.5, 'EdgeColor','none')
patch([105 115 115 105], [[1 1]*min(ylim) [1 1]*max(ylim)], [1 1 1]*0.6, 'FaceAlpha',0.5, 'EdgeColor','none')
hold off
Experiment to get the desired result.
.
2 Commenti
Star Strider
il 6 Ott 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!