I'm creating an EPS-file from a Matlab figure by using the equivalent of the following Matlab code:
Code: Select all
fig = figure;
subplot(2,1,1)
plot(X_data_1, Y_data_1)
grid on
ylabel('label')
title('title')
subplot(2,1,2)
plot(X_data_2,Y_data_2)
grid on
ylabel('label')
xlabel('label')
print(fig, 'fig_name', '-depsc', '-tiff')
Code: Select all
\includegraphics{fig_name.eps}
The original fig_name.eps file displays all the plots, I've viewed it in Acrobat, SumatraPDF and Inkscape, which all show all plot lines perfectly fine. However, when I open the pdf file which was generated, only the first plot shows, not the plot in the second subplot. Let me provide the differences: I've uploaded both files + a screenshot of the difference.
One fix was to append the following lines to the Matlab code before the printing:
Code: Select all
hold on
plot(5,-20,'sm') % Adds a single point of a magenta colored square to the last plot.
Does anyone know what's wrong here?
EDIT: I also tried with the codec -depsc2, did not help.