How can I export this as a vector image?

Hello,
normally I can easily export matlab figures (that do not have a gradient) to Powerpoint simply by copy-pasting it. I just need to set the "copy options" to "metafile". Upon pasting it in Powerpoint I just try to ungroup it, done.
However, for the attached figure this does not work. It stays a graid/pixel image in Powerpoint.
Any idea why?
Thanks,
Toby

Answers (1)

Use export_fig function. Check the link here.
I would suggest the add
set(gcf,'color','w')
before using export_fig function. This way you can avoid gray boundaries. May be storing in PNG would be good too if you just want to use the image in powerpoint. Otherwise, you can also save the images in eps format. Following line would do the job once you have added the functions from Add-ons.
export_fig name.png -m2.5

4 Comments

Hi and thanks for the hint. Unfortunately this does not work.
I downloaded the most recent version of export_fig and tried the "set(gcf, 'color','w'), then used
export_fig name.pdf -m2.5
The resulting figure is still pixelated, not a vector. I get the following warning that could be related:
"Warning: export_fig currently supports transparent patches/areas only in PNG output.
To export transparent patches/areas to PDF, use the print command:
print(gcf, '-dpdf', 'name.pdf');
> In export_fig (line 523)
Warning: You seem to be using axes that have overlapping/hidden graphic elements.
Setting axes.SortMethod='ChildOrder' may solve potential problems in EPS/PDF export.
Additional info: https://github.com/altmany/export_fig/issues/211
> In print2eps (line 280)
In export_fig (line 841) "
However, I am not sure if using export_fig is realy necessary. I never had problem exporting figures in Matlab as vectors to Powerpoint. This is the first time. Note that I only use Powerpoint as a vehicle, eventually I save the ppt as a pdf.
Best,
Tobias
waqas
waqas on 26 Jul 2020
Edited: waqas on 26 Jul 2020
I am not sure why it is not working with for you. Why dont you try PNG format? I think it would be vectorized enough to use for powerpoint. Otherwise, if you want publication quality, then we need to resolve overlapping/hidden graphic elements error. Check the attached PNG quality.
export_fig is helps in getting eps images. Atleast in previous versions, I had troubles getting the eps for plots like these so this function was the only solution that I found.
PNG does work for me and it looks similar to the figure you uploaded. Unfortunately, PNG is not a vector format. I need a vector graphic. It is indeed for a publication. I am not sure what you mean by "vectorized enough" - my understanding is that it is either vectorized (eps, pdf) or it is not (jpg, tif, bmp, png etc.), there is nothing in between.
Well if you want to use eps/pdf for publication then I used the same method as I mentioned above only changed the format to eps and it worked fine for me! I also imported the eps file to LaTex to see the quality. It looks the same to me.
I cannot upload the file here so giving the drive link for you to download and see. google drive
Regarding PNG, if you know the dimensions that you will be setting in the final plot then a PNG format file once saved would have enough detailed information.Just a disclaimer, this is my personal opinion.

Sign in to comment.

Categories

Find more on Printing and Saving in Help Center and File Exchange

Asked:

on 22 Jul 2020

Commented:

on 26 Jul 2020

Community Treasure Hunt

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

Start Hunting!