# plot traveltimes axes configuration

1 view (last 30 days)
Ancalagon8 on 11 Nov 2018
Commented: jonas on 12 Nov 2018
Hello, i have some seismic survey data (7 channels) and tried to plot them all in one figure without axes. So far so good but I want all 7 subplots to have one common x-axis and one common y axis. Any ideas?
My code is the following
clear all
L=length(G1);
Fs=2048;
t=(L/1000) - 0.0001;
tvect = (0:0.001:t)';
figure
subplot (1,7,1)
plot (G1,tvect,'k')
hold on
ylim ([0 2])
haxes = gca;
axis off
set(gca,'Ydir','reverse')
subplot (1,7,2)
plot (G2,tvect,'k')
hold on
ylim ([0 2])
haxes = gca;
axis off
set(gca,'Ydir','reverse')
subplot (1,7,3)
plot (G3,tvect,'k')
hold on
ylim ([0 2])
haxes = gca;
axis off
set(gca,'Ydir','reverse')
subplot (1,7,4)
plot (G4,tvect,'k')
hold on
ylim ([0 2])
haxes = gca;
axis off
set(gca,'Ydir','reverse')
subplot (1,7,5)
plot (G5,tvect,'k')
hold on
ylim ([0 2])
haxes = gca;
axis off
set(gca,'Ydir','reverse')
subplot (1,7,6)
plot (G6,tvect,'k')
hold on
ylim ([0 2])
haxes = gca;
axis off
set(gca,'Ydir','reverse')
subplot (1,7,7)
plot (G7,tvect,'k')
hold on
ylim ([0 2])
haxes = gca;
axis off
set(gca,'Ydir','reverse')
##### 2 CommentsShowHide 1 older comment
Ancalagon8 on 12 Nov 2018
Exactly!

jonas on 12 Nov 2018
Edited: jonas on 12 Nov 2018
Try this. You can set 'xtick' to [], if you want to retain only the labels.
tvect = out.tvect;
for i=1:7
data.(sprintf('G%g',i)) = out.(sprintf('G%g',i));
end
figure;hold on
for i=1:7
ax(i) = subplot(1,7,i,'ycolor','none','color','none',...
'xaxislocation','top');hold on
plot(data.(sprintf('G%g',i)),tvect);
xl(i) = xlabel(sprintf('G%g',i));
set(xl(i),'position',xl(i).Position)
text(0,0,sprintf('G%g',i),'horizontalalignment','center')
end
set(ax(1),'ycolor','k')
ylim([0 2])
jonas on 12 Nov 2018
My pleasure!

### Categories

Find more on Subplots in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by