How to plot a region in a Matlab plot?

Hi All,
I want to shade(filled) several regions in a 2D plot by different colors. The attachment contains the plot I am expecting to plot. I could not find a better tutorial to plot this figure yet. Could you please give some help on this. Thank you in advance.
The boundaries of the given region is given by following functions.
P1 = range from 0 to 5
temp = range from 600 to 1600
Tttg1 = 760.-60.*(P1-1.)**2.
Tttg2 = 1000.-150.*((P1-1.2)/1.2)**2.
Pttg1 = -0.5*((temp-870.)/220.)
Pttg2 = 1.5+0.7*((temp-700.)/200.)
Pttg3 = 1.
Tttg3 = 1000. # pr3
Tttg4 = 1100.+50.*((P1-3.5)/3.5)**2. # pr4
Pttg4 = 2.35 +0.15*((temp-1000.)/100.) # Tr4/1000
Pttg5 =5.
%3 regions
lpttg_con = (temp>Tttg1) & (temp<Tttg2) & (P1>Pttg1) & (P1<Pttg2) & (P1<Pttg3)# & matcon_WB
mpttg_con = (temp>Tttg1) & (temp<Tttg2) & (P1>Pttg1) & (P1<Pttg2) & (P1>=Pttg3)# & matcon_WB
hpttg_con = (temp>Tttg3) & (temp<Tttg4) & (P1>Pttg4) & (P1<Pttg5)
Thanks
Prasanna

2 Kommentare

KSSV
KSSV am 18 Feb. 2020
Read about patch and fill.
Prasanna
Prasanna am 18 Feb. 2020
Bearbeitet: Prasanna am 18 Feb. 2020
Thank you for the suggestion.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Joseph Cheng
Joseph Cheng am 18 Feb. 2020
Bearbeitet: Joseph Cheng am 18 Feb. 2020

0 Stimmen

here is quick example of what you can do by putting the regions as an image under the plots:
%gen xy spans
temps=0:.1:100;
press = 0:.1:100;
[x y] = meshgrid(temps,press);
%generate the binary mask regions
r1 = x.^2+y.^2<50;
r2 = (x-50).^2+(y-75).^2<50^2;
figure(1),imagesc(r1,'XData',temps, 'YData', press , 'AlphaData', r1)
hold on
imagesc(r2*2,'XData',temps, 'YData', press , 'AlphaData', r2) %r2 scaled to get different color
colorbar
plot(temps,press.^2+4)
plot(temps+50,(press-10).^3+4)

1 Kommentar

Prasanna
Prasanna am 18 Feb. 2020
Bearbeitet: Prasanna am 18 Feb. 2020
Thank you. That was a great help. I could plot the regions with that.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Surfaces, Volumes, and Polygons finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2017b

Gefragt:

am 18 Feb. 2020

Bearbeitet:

am 18 Feb. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by