MATLAB Answers

How to adjust matlab figure size to powerpoint

71 views (last 30 days)
Amine Aboufirass
Amine Aboufirass on 5 May 2017
Answered: Chaitral Date on 9 May 2017
Currently I am outputting figures from matlab to the current directory using the following short script:
plot(1:10) % Example graph
set(gcf,'PaperUnits','centimeters','PaperPosition',[0 0 12 12])
print -djpeg filename.jpg -r200
Then I am copying this jpeg output into powerpoint to see the effects of modifying -r200 and/or the last argument of the set() function, namely 12 and 12.
What I am noticing is that changing from r100 to r200 does increase the resolution but it also increases the image size when I paste into powerpoint. Setting the image size using the set() function also changes the size but not as expected. For example the above produced an image in Powerpoint which was indeed square but not recognized by powerpoint as 12cm x 12cm. Powerpoint recognized it as being 16.7 cm by 16.7 cm.
I need to produce an image that Powerpoint recognizes as EXACTLY being 12 cm by 12 cm. How do I do this please?

Answers (1)

Chaitral Date
Chaitral Date on 9 May 2017
Set the 'PaperPosition' and 'resolution' properties for the figure as given below to get the image size exactly as 12x12 cm in powerpoint.
set(gcf,'PaperUnits','centimeters','PaperPosition',[0 0 11.5 11.5]);
print -djpeg filename.jpg -r100;
I hope this helps.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!