Saving MATLAB charts at a specific resolution

How to change the resolution of my MATLAB graphs? The default value is 96x96 PPI .

+7
source share
2 answers

You can save using the print command; here as:

 h1=figure; your plotting commands here print(h1,'-djpeg','-r150','filename') 

The -r150 argument sets the resolution to 150 DPI. You can set it higher or lower depending on your needs. It is assumed that you save JPEG. If not, there are other options like -dpng for PNG, -dbmp for 24-bit bitmap, etc. More can be found in the help section for print .

However, if your plot consists only of lines, I would recommend using -depsc , which saves it as an EPS file, which is scalable and lossless. You will also not need to determine the resolution, so you can just do

print(h1,'-depsc','filename')

You can convert this EPS file to PDF and keep the same resolution, but have portability between applications and platforms. I would not recommend saving the PDF directly, since MATLAB places extra white spaces around the plot if the EPS bounding box is dense and looks neat.

+18
source

Change Picture Settings : Resolution Setting

+3
source

All Articles