MATLAB: How to export the whole figure plotted in matlab using export_fig

export_fig

I have several graphs that I need for a thesis, which means that figures need a high resolution. But when trying to use export_fig the resulting image is zoomed in, leaving out important part of the graphs. I tried using one of matlabs own examples that look like this: plot(cos(linspace(0, 7, 1000))); set(gcf, 'Position', [200 200 150 150]); saveas(gcf, 'test.png'); export_fig test2.png The resulting images are attached where test2 is the exported image. The first example on this page https://github.com/altmany/export_fig is showing how the exported picture should look like. Since the code is running it is hard to know why the exported picture excludes important parts. So, how do I expand the area of the original plot that is exported in high resolution? I want to be able to export the image as I see it when it is plotted in matlab with as high resolution as possible. I already tried matlabs original save as, export, and copy, but since none of these gave good enough images I tried with export_fig. Any help is much appreciated!

Best Answer

Try this:
>> set(gcf,'PaperOrientation','landscape');
>> print -dpdf myFig -fillpage
Related Question