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.

 채택된 답변

Image Analyst
Image Analyst 2013년 2월 5일

0 개 추천

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.

추가 답변 (1개)

Shashank Prasanna
Shashank Prasanna 2013년 2월 5일

4 개 추천

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

Stan Kruger
Stan Kruger 2015년 10월 23일
편집: Stan Kruger 2015년 10월 23일
Works great, thanks for clear answer!
Inesteroide
Inesteroide 2018년 10월 23일
Can you please share the code?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

태그

질문:

2013년 2월 5일

댓글:

2018년 10월 23일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by