How to set the background color for the selected data in the plot?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
For example, Here is:
t=0:0.1:100;
x=sin(t);
plot(t,x)
So the plot will show a sin wave.
And now, I select the sin data between t=0:0.1:20, and decide to set the background color as red for the selected data between t=0:0.1:20.
So how to do this in the same plot?
Besides, how to do if I want to change the selected data color to red in the same plot?
0 commentaires
Réponses (1)
Walter Roberson
le 10 Sep 2015
plot() uses line objects, and those can only have one color per line.
There are a number of routines in the File Exchange that allow you to control color along a line. See http://www.mathworks.com/matlabcentral/answers/100246-how-do-i-create-a-2-d-or-3-d-line-that-changes-colors-along-the-data-points for one discussion
0 commentaires
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!