How to suplot 3 images (2D data) horizontally?

1 次查看(过去 30 天)
I have 3 sets of 2D data that I would like to plot horizontally as part of one figure only. Here's the code:
clc; clear all;
load infinite;
load finite;
load gain;
% transpose matrix is not required
A1= log10(fs1);
A2= log10(fs2);
A3= log10(fs3);
subplot(1,3,1);p1=pcolor(ky*1e-6,f/1e12,A1);
xlabel('k_{\ity}({\mu}m^{-1})') ;
subplot(1,3,2);p2=pcolor(ky*1e-6,f/1e12,A2);
xlabel('k_{\ity}({\mu}m^{-1})') ;
subplot(1,3,3);p3=pcolor(ky*1e-6,f/1e12,A3);
xlabel('k_{\ity}({\mu}m^{-1})') ;
ylabel('{\itf} (THz)');
%colormap setting
shading interp;
colormap jet;%colormap need to be set to jet for Blue-yellow-red map
%colorbar setting
c = colorbar;
%labels the colorbar vertically as desired
set(get(c,'label'),'string','logscale');
c.TickLength=.056;
c.Units='pixel';
c.FontWeight='bold';
%font properties
FS='Fontsize';
fs=18;
FN='Fontname';
fn='Times New Roman';
set(findall(gcf,'type','axes'),FS,fs,FN,fn);
set(findall(gcf,'type','text'),FS,fs,FN,fn);
But for some reason the first two subplots are all blacked out:
problem.jpg
What seems to be the issue here ? Also, the subfigures are really thin. I would like them to be the proper size for viewing ease. Also, I would like only one ylabel on the far left and one color bar on the far right. Can anyone help me please? I am new to Matlab.
TIA,
Zihad Azad
P.S.:The tables are attached herewith.

回答(2 个)

KSSV
KSSV 2019-12-18
  1 个评论
Zihad Azad
Zihad Azad 2019-12-18
Thanks for your reply. But these two issues that you noted are a little different from mine. Mine has to do with subplotting 3 2D data sets.And for some reason, I am unable to do it

请先登录,再进行评论。


Zihad Azad
Zihad Azad 2019-12-18
No worries solved it already. Had to define the shading properties after each subplot. That's all:
clc; clear all;
load infinite;
load finite;
load gain;
% transpose matrix is not required
A1= log10(fs1);
A2= log10(fs2);
A3= log10(fs3);
h1=subplot(1,3,1);
p1=pcolor(ky*1e-6,f/1e12,A1);
xlabel('k_{\ity}(m^{-1})(\times 10^6)') ;ylabel('{\itf} (THz)');
title('(a)', 'FontSize', 30,'units','normalized','position',[.1 .9]); %gotta normalize the units to the figure window
set(h1, 'Units', 'normalized');
get(h1, 'Position')
set(h1,'Position',[ 0.07 0.1100 0.27 0.8150]);
%colormap setting
shading interp;
colormap jet;%colormap need to be set to jet for Blue-yellow-red map
h2=subplot(1,3,2);
p2=pcolor(ky*1e-6,f/1e12,A2);
xlabel('k_{\ity}(m^{-1})(\times 10^6)');set(gca,'Yticklabel',[]);
title('(b)', 'FontSize', 30,'units','normalized','position',[.1 .9]);
set(h2, 'Units', 'normalized');
get(h2, 'Position')
set(h2,'Position',[ 0.36 0.1100 0.27 0.8150]);
%colormap setting
shading interp;
colormap jet;
h3=subplot(1,3,3);
p3=pcolor(ky*1e-6,f/1e12,A3);
xlabel('k_{\ity}(m^{-1})(\times 10^6)');set(gca,'Yticklabel',[]);
title('(c)', 'FontSize', 30,'units','normalized','position',[.1 .9]);
set(h3, 'Units', 'normalized');
get(h3, 'Position')
set(h3,'Position',[ 0.65 0.1100 0.29 0.8150]);
%colormap setting
shading interp;
colormap jet;%colormap need to be set to jet for Blue-yellow-red map
%colorbar setting
c = colorbar;
%labels the colorbar vertically as desired
set(get(c,'label'),'string','logscale');
c.TickLength=.023;
c.Units='pixel';
c.FontWeight='bold';
%font properties
FS='Fontsize';
fs=22;
FN='Fontname';
fn='Times New Roman';
set(findall(gcf,'type','axes'),FS,fs,FN,fn);
set(findall(gcf,'type','text'),FS,fs,FN,fn);
% print -depsc dispersion.eps;

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by