clear all

% Plot Raoult's law ideal vapor pressure.
% 
% Executes properly on MATLAB version 9.4.0.813654 (R2018a).
% Executes mostly properly on OCTAVE version 4.2.1.
% Joshua C. Vaughan 1/30/2021

n = 2^8;
Xa = linspace(0,1,n);
Pa_pure = 0.55;
Pb_pure = 1;

Pa = Xa*Pa_pure;
Pb = (1-Xa)*Pb_pure;j
Ptot = Pa+Pb;

% create plot

ax_lw = 2;
pl_lw = 3;
ax_fs = 30;
la_fs = 30;
ti_fs = 30;
lg_fs = 24;
fontname = 'Arial';

figure(1); clf
plot(Xa,Pa,'r',Xa,Pb,'b',Xa,Ptot,'k','linewidth',pl_lw)

xlabel('Mole Fraction of A, {\itX}_A','fontsize',la_fs)
ylabel('Pressure','fontsize',la_fs)
set(gca,'fontsize',la_fs)
set(gca,'linewidth',ax_lw)
set(gca,'tickdir','out')
set(gcf,'color',[1 1 1])
set(gca,'fontname',fontname)
xlim([0 1])
ylim([0 1.05])
set(gca,'xtick',[0, 1])
set(gca,'ytick',[0, Pa_pure, 1])
set(gca,'yticklabel',{'0','{\itP}_A^*','{\itP}_B^*'})
set(gca,'LooseInset',get(gca,'TightInset'));

% add legend
h = legend('{\itP}_A','{\itP}_B','{\itP}_{total}');
set(h,'fontsize',lg_fs);
set(h,'linewidth',1.5);
set(h,'position',[0.2230 0.4217 0.2033 0.3220])
set(h,'box','off')