Range limits with plot background color
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Adam
am 5 Feb. 2013
Kommentiert: Inesteroide
am 23 Okt. 2018
Hello Forum, I am trying to set the plot background of a series of plots to be white and for y-axis values above 60 grey. Is there a way to do this? I am trying to highlight values above a certain criteria. Other suggestions are welcome. Thanks.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 5 Feb. 2013
Maybe use the rectangle() or patch() function to lay down a gray rectangle in the appropriate place in the plot. Be sure to set "hold on" after that and before you plot your actual data.
0 Kommentare
Weitere Antworten (1)
Shashank Prasanna
am 5 Feb. 2013
clf
plot(rand(10,1),'-o')
yUp = 0.7;
x=get(gca,'XLim');
y=get(gca,'YLim');
patch('XData',[x fliplr(x)],'YData',[yUp yUp y(2) y(2)],'FaceColor','r','FaceAlpha',0.3)
2 Kommentare
Stan Kruger
am 23 Okt. 2015
Bearbeitet: Stan Kruger
am 23 Okt. 2015
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/179162/image.png)
Works great, thanks for clear answer!
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!