Why is EPS output sometimes different from on screen version using painters renderer?

1 view (last 30 days)
I have an issue when outputting an EPS version of an image from MATLAB. The EPS looks different to the on screen version and the PNG output of the same image.
The code below, run on MATLAB R2012b, produces an EPS file which is different from the PNG. Notably the grid is offset on the right hand panel which is the same (random) data just with a flipped axis.
clear all
close all
A=rand(40,20);
figure
subplot(1,2,1);
imagesc(0.5:19.5,-85.5:2.5:14.0,A);
ylim([-6.2 11.1]);
set(gca,'FontSize',13);
subplot(1,2,2);
imagesc(0.5:19.5,-85.5:2.5:14.0,A);
set(gca,'YDir','normal');
ylim([-6.2 11.1]);
set(gca,'FontSize',13);
colormap(pink(10));
print('-depsc2','a.eps');
print('-dpng','a.png');
Any ideas as to why? This error doesn't seem to occur if using a non-'painters' renderer. And the grids are fine when the axis uses the standard direction for imagesc, but not when flipped.
Thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!