I'm creating some plots in matlab and then saving it as EPS images.
What is important, I create sets of 4 images, take the 'YLim' value from the first image, and then set it to the other 3 images. I do it to force the same Y-axis limits for each image in the set.
So for the first image, I create some figure, plot something on it, and take it's YLim
property:
f = figure('position', [50, 70, 900, 700], 'Units', 'normalized');
p = plot(s+n, 'k');
set(gca, 'XLim', [0, 2048]);
set(gca, 'XTick', 200:400:1800);
ylim = get(gca, 'YLim');
saveas(gcf, 'some_name', 'epsc');
Then, for next 3 images, I also create the figure, plot something, and set all needed properties:
f = figure('position', [50, 70, 900, 700], 'Units', 'normalized');
p = plot(s, 'k');
set(gca, 'XLim', [0, 2048]);
set(gca, 'XTick', 200:400:1800);
set(gca, 'YLim', ylim)
saveas(gcf, 'some_other_name', 'epsc');
Now, what is strange. Matlab displays these images correctly and all of them have the same Y-axis limits (for example -10:60)
But the saved EPS files have different limits, for example, first has -10:60 but second has -20:60. So, in other words, saved EPS files are not exactly the same as displayed charts.
What am I doing wrong?