Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save a high-resolution figure in MATLAB

When I save a figure from MATALB, I'd like the resulting image to have very high resolution so that I can zoom in to see detail in the image. When I use 'File --> Save As' on a figure, the image is not high resolution.

How can I save a figure to a high resolution image in MATLAB?

like image 865
r9 fan Avatar asked Sep 25 '15 20:09

r9 fan


People also ask

How do I save a high quality figure in MATLAB?

To get a high-resolution image from MATLAB, you may use the "copy figure" option. In your Matlab figure, go to the "Edit" option, select "Copy Figure", then paste it in MS word file using "crtl+v". If you want to use the figure in latex, then save the figure in the ". eps" format.

How do I save a figure in MATLAB?

To save the current figure, specify fig as gcf . saveas( fig , filename , formattype ) creates the file using the specified file format, formattype .

Can you save a MATLAB plot as a JPEG image?

Save Plots InteractivelyThe export button supports three image formats (PNG, JPEG, and TIFF), as well as PDF files, which can contain images or vector graphics, depending on the content in the axes.


1 Answers

You can specify a desired resolution to save the image, either from the command line or from the File menu.

Command line: Using print, just include the option -r###, where ### if the resolution you want. Usually 300 dots-per-inch (dpi) is plenty high enough resolution for my purposes, but feel free to go higher if needed. Obviously the higher the dpi the larger the image file size will be.

print(gcf,'foo.png','-dpng','-r300');         *// 300 dpi

Check out the MATLAB print documentation to see all the print options you can adjust like this.

File menu: Or using 'File -> Export Setup...', on the left select 'Rendering', then adjust the 'Resolution (dpi)'. By default it set to 'auto'.

As with the command line, there are many printing options you can adjust in the File menu. Once you've tinkered a little bit and gotten everything how you want it, you can save the current export settings as default so you don't have to do it every time you save a figure. This is done on the bottom of the same menu 'Export Styles --> Save as style named:' --> choose "default" and click 'Save'.

Here are some more good tips for saving nice figures in MATLAB:

like image 180
Geoff Avatar answered Oct 30 '22 01:10

Geoff