0

I have the following code to print a calculated level overlayed to a google earth image.

im = imread('googleEarthImage.png');

figure
imagesc(lon,fliplr(lat),im);  set(gca, 'YDir', 'normal');
hold on
pcolor(lon,lat,level); shading flat; axis([min(lon) max(lon) min(lat) max(lat)]);

% Save figure
set(gcf,'InvertHardcopy','on');
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 6 5])
print('level','-dpng','-r300');

The problem with the code is that the printed image won't contain the background google earth image. The google earth image is replaced by a white background. However, when I remove

axis([min(lon) max(lon) min(lat) max(lat)]);

I get the calculated level with the google earth image in the background but it is zoomed out since I can't use axis(). Any help in the right direction is much appreciated. Thanks

mikeP
  • 801
  • 2
  • 11
  • 20
  • So, if you know how to get the correct result, why don't you just use it? Additionally, use the `export_fig` package in Matlab's File exchange, usually works. Google it. Hope it helps – Ander Biguri Jan 12 '15 at 15:55
  • I edited the question. I get the image that I want but it is not in the proper axis limits since I can't use axis(). export_fig doesn't seem to help. The problem seems to be related to adding axis() which has an effect of removing the background image when printed but I have no idea why. The problem shows up as well if I change axis() with xlim() and ylim(). – mikeP Jan 12 '15 at 16:09
  • try using the low level function `set(gca,'XLim',[min(lon) max(lon)],'YLim',[min(lat) max(lat)])`. – Hoki Jan 12 '15 at 16:39

0 Answers0