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

1 次查看(过去 30 天)
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

请先登录,再进行评论。

更多回答(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