-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPLOT_2DImage.m
73 lines (67 loc) · 2.49 KB
/
PLOT_2DImage.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function PLOT_2DImage(x,z,PMD,fpath,LIMIT,clrmap,figname,fignum)
global y_min y_max x_min x_max dis_intsc ExportEPSFig dis_min dis_max rho_salt_min rho_basement_max sus_basement_max
figure('units','normalized','outerposition',[0 0 1 1],'visible','off');
% mycolormap = jet;
% mycolormap(1,:) =1;
imagesc(x,z,PMD),cbar=colorbar;%caxis([0 1])
axis square
% caxis([rho_salt_min rho_basement_max])
% caxis([0 sus_basement_max])
caxis(LIMIT)
xlim([dis_min dis_max])
cbar.Label.String = figname;
ax1=gca;
ax1.XAxis.TickLabelRotation = 0;
ax1.XAxis.Exponent = 0;
set(ax1,'fontsize',15,'fontweight','bold')
Xticks = round(linspace(dis_min,dis_max,6),2);
xticks(ax1,Xticks);
ax1.XAxis.Exponent = 0;
Xticks = round(linspace(x_min,x_max,6),2);
xticklabels(ax1,string(Xticks))
% xtickformat('%.0f')
if contains(clrmap, 'jet')
mycolormap = jet;
mycolormap(1,:) =1;
colormap(mycolormap);
elseif contains(clrmap, 'bluewhitered')
colormap(bluewhitered);
elseif contains(clrmap, 'WhiteBlueGreenYellowRed')
WhiteBlueGreenYellowRed = load('WhiteBlueGreenYellowRed.txt');
if max(PMD,[],'all')<= 0
colormap(flipud(WhiteBlueGreenYellowRed));
else
colormap(WhiteBlueGreenYellowRed);
end
end
set(gca,'Ydir','reverse')
ylabel('Depth (m)'),xlabel('X Profile (m)')
shading interp
hold on
%quiver(dis_intsc(1), 5000,dis_intsc(2)-dis_intsc(1),0,0,'Color','black','linewidth',3,'MaxHeadSize',0.1)
hold on
%quiver(dis_intsc(2), 5000,dis_intsc(1)-dis_intsc(2),0,0,'Color','black','linewidth',3,'MaxHeadSize',0.1)
%text(mean([dis_intsc(1),dis_intsc(2)])-5000,5000-300,'Ghasha','fontsize',15,'Color','black','FontWeight','bold')
%%% the second axes (MCMC iterations)
ax2=axes('Position',ax1.Position,'xlim', [dis_min, dis_max], 'color', 'none',...
'YTick',[],'YColor','none','XColor','k', 'XAxisLocation', 'top');
Xticks = round(linspace(dis_min,dis_max,6),2);
xticks(ax2,Xticks);
ax2.XAxis.Exponent = 0;
Yticks = round(linspace(y_min,y_max,6),2);
xticklabels(ax2,string(Yticks))
set(ax2,'fontsize',10,'fontweight','bold')
xlabel(ax2,'Y Profile (m)','color','k');
axis square
% box(ax2,'off')
% Save Figure
set(gcf,'color','w');
img = getframe(gcf);
figname = strrep(figname,'(gr/cm^{3})',[]);
imwrite(img.cdata, [fullfile(fpath,strcat(figname,num2str(fignum))), '.png']);
% Save eps Figure
if ExportEPSFig == 1
figname= figname(find(~isspace(figname)));
print(gcf,'-depsc2','-painters',fullfile(fpath,strcat(figname,num2str(fignum))));
end
end