I want to save a MATLAB figure as PDF, with quality 300 DPI, and centered.
So far I managed to save it, but the image appears cropped. I changed the page type to A3 and kind of solves the problem, but I am looking for something more elegant. I am doing it from the GUI, but maybe from the command line is easier in MATLAB.
Is there any package or script that makes this (fundamental task for publications and papers) a bit easier?
To save a figure as an image at a specific resolution, call the exportgraphics function, and specify the 'Resolution' name-value pair argument. By default, images are saved at 150 dots per inch (DPI). For example, create a bar chart and get the current figure. Then save the figure as a 300-DPI PNG file.
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.
If it is only a single figure, use the GUI of the export-setup. File > Export Setup ... > Rendering > Resolution (dpi) + don't forget to click Apply to Figure.
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.
Try using the following command:
print -painters -dpdf -r300 test.pdf
You will, of course, already have to have a file named test.pdf in the current directory.
Some notes on the -commands as well.
On an off note. I tend to just save the figure as a high DPI tiff image and import that tiff into another program where I actually assemble my figure(s) for the paper. I tend to lean towards CorelDraw personally.
I would recommend to check the exportfig
package
exportfig(gcf, path_to_file, 'format','pdf','Resolution', 300 )
also, you can check fig
package, which is nice to call before the exportfig
:
figure
plot(x,y)
fig
exportfig(gcf, path_to_file, 'format','pdf','Resolution', 300 )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With