How to set the background color for the selected data in the plot?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!