How to color a small squared or half squared zone of the plot?

조회 수: 2 (최근 30일)
Nisar Ahmed
Nisar Ahmed 2021년 12월 30일
댓글: Nisar Ahmed 2022년 1월 3일
Hi, everyone, here it is graph between P vs t, as shown below and the data is also attached here. I want shade a say light blue color in the squre zone having Y axis limit 1865 - 1890. The shade should be in transparent color and plot have to be in stairs and visible within shade zone. How I acn do it, if not complete squared zone, then left half part with same y axis limits should be in colored patch.

채택된 답변

KSSV
KSSV 2021년 12월 30일
B = [23 1865; 36 1865; 36 1890 ; 23 1890] ;
patch(B(:,1),B(:,2),'b') ;
hold on
plot(p,t) ;
  댓글 수: 3
KSSV
KSSV 2022년 1월 3일
편집: KSSV 2022년 1월 3일
You need to use hold on.
subplot(1,5,2);
B = [20 1865; 40 1865; 40 1890 ; 20 1890];
patch(B(:,1),B(:,2),'b');
hold on
stairs(p,t,'k');
set(gca, 'ydir', 'reverse');
box on
Nisar Ahmed
Nisar Ahmed 2022년 1월 3일
@KSSV Thank you very much, it is working now

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by