Use "fill" in a datetime/value plot to color the background
Show older comments
Hello, i want to plot a value ove time series, where the time is stored in the matlab specific time format. Furthermore i want to color the background of this plot to symbolise different states of the represented machine. How can i adapt the fill command to work with these conditions ? Its important that the axes changes the displayed time when i zoom into the figure.
Thanks in advance
%the plot
t = datetime(2014,6,28) + caldays(1:10);
y = rand(1,10);
plot(t,y);
%fill background:
%black between Jun30 and Jun31, between Juli4 and Juli5
%red for the rest
Accepted Answer
More Answers (0)
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!