Cannot zoom x axis properly with multiple 2D plots in same figure - linkprop?
Show older comments
I cannot figure out how to get the x axis to zoom properly. Y axis works fine because all of the y data is the same scale. But because I am plotting different xlim per plot linkaxes just can seem to do it. I have tried working with linkprop to no avail either, although maybe the answer is buried in there somewhere. I tried to simplify my code for posting but thought you might as well get it all and the data too, so links are provided. Any insight is appreciated.
data.png = Link to my plot
data.mat = Link to my data
figure
axesPosition = [.032 .01 .955 .99];
axes('position',axesPosition,'xtick',[],'ytick',[],'xTickLabel',{},'yTickLabel',{});
h = [];
for i = 1:size(disColWant,2)-1 + size(ctdColWant,2)-1;
if i <= size(disColWant,2)-1;
h(i) = axes('position',axesPosition);
plot(h(i), disNumData(:,disColNum(:,i+1)),...
(disNumData(:,(disColNum(:,1))))*-1,...
'linestyle',Config.LineStyle.(disColWant{i+1}),...
'color',Config.Color.(disColWant{i+1}),...
'marker',Config.MarkerStyle.(disColWant{i+1}),...
'markersize',Config.MarkerSize);
set(gca,'xlim',Config.Scale.(disColWant{i+1}),...
'ylim',Config.Scale.(disColWant{1}),...
'visible','off');
else h(i) = axes('position',axesPosition);
plot(h(i),ctdNumData(:,ctdColNum(:,i-11)),...
(ctdNumData(:,(ctdColNum(:,1))))*-1,...
'linestyle',Config.LineStyle.(ctdColWant{i-11}),...
'color',Config.Color.(ctdColWant{i-11}),...
'marker',Config.MarkerStyle.(ctdColWant{i-11}),...
'markersize',Config.MarkerSize);
set(gca,'xlim',Config.Scale.(ctdColWant{i- 11}),...
'ylim',Config.Scale.(ctdColWant{1}),...
'visible','off');
end
end
linkaxes(h,'y')
Accepted Answer
More Answers (0)
Categories
Find more on Data Exploration 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!