function Figure7_5

% Matlab code for Figure 7.5 in book:
% Radek Erban and Jon Chapman, Stochastic Modelling of Reaction-Diffusion
% Processes, Cambridge University Press, 2019

close all;

histogram=load('data_Figure7_5_b.dat');
mesh=100;
ponetwo=reshape(histogram,mesh,mesh);

figure(1);
set(gca,'Fontsize',18);
pcolor(4*[1/(2*mesh):1/mesh:1-1/(2*mesh)]',4*[1/(2*mesh):1/mesh:1-1/(2*mesh)]',ponetwo);
xlabel('$x_1$','interpreter','latex');
text(-0.4,3.6,'$x_2$','Fontsize',18,'interpreter','latex');
zlabel('$P(x,y)$','interpreter','latex');
axis([0 4 0 4 -0.01 9]);
set(gca,'XTick',[0 1 2 3 4]);
set(gca,'YTick',[0 1 2 3 4]);
shading flat;
view(0,90);
shading interp;
box on;
v=caxis;
colormap jet;
set(gca,'Fontsize',18);

histogramNI=load('data_Figure7_5_c.dat');
mesh=100;
ponetwoNI=reshape(histogramNI,mesh,mesh);

figure(2);
set(gca,'Fontsize',18);
pcolor(4*[1/(2*mesh):1/mesh:1-1/(2*mesh)]',4*[1/(2*mesh):1/mesh:1-1/(2*mesh)]',ponetwoNI);
xlabel('$x_1$','interpreter','latex');
text(-0.4,3.6,'$x_2$','Fontsize',18,'interpreter','latex');
zlabel('$P(x,y)$','interpreter','latex');
axis([0 4 0 4 -0.01 9]);
set(gca,'XTick',[0 1 2 3 4]);
set(gca,'YTick',[0 1 2 3 4]);
shading flat;
view(0,90);
shading interp;
box on;
colormap jet;
caxis(v);
set(gca,'position',[0.3 0.12 0.67 0.8]);
set(colorbar,'position',[0.05 0.05 0.06 0.89]);
box on;
set(gca,'Fontsize',18);
