matlab export plot to vector format

前端 未结 7 707
感情败类
感情败类 2021-01-04 13:21

All the time previously I was exporting Matlab figures in a raster format (JPG, PNG)

Is there a way to export a plot from Matlab in a vector format (SVG). I need it

相关标签:
7条回答
  • 2021-01-04 13:48

    For my publications I save the plot as an EPS (which is vectorized), then do any final touches in Inkscape. Then through Inkscape you can export it to something like SVG. Inkscape has a bunch of tools that are handy for cleaning up a plot (such as simplifying paths and shading).

    That's how I made the following T-s diagram:

    Normal-Shock Solutions on T-s

    0 讨论(0)
  • 2021-01-04 13:52

    Matlab vector graphics is broken in the root level since 2014a.
    So don't bother to swich from .png format.

    Mee my melancholic question with further refferences in matlab Q&A section: https://se.mathworks.com/matlabcentral/answers/290313-why-is-vector-graphics-chopped-into-pieces

    0 讨论(0)
  • 2021-01-04 13:54

    .eps files are easy enough to export and use with LaTeX. I use a function in every project that formats and saves plots to a LaTeX project. It works pretty easily. The 'eps' in the following line can be changed to any Matlab image type.

    Something like:

    figures = sort(findobj('MenuBar','figure'));
    for ii = 1:length(figures)
        saveas(gcf,['Figures/',num2str(ii)],'eps')
    end
    
    0 讨论(0)
  • 2021-01-04 13:54

    I have exported a matlab figure in .eps then converted the same to .png with GIMP. It turns out that the .png file obtained this way is of much higher quality than the .png files obtained directly from MATLAB figure file by exporting or saveas option. Note that I have used a higher resolution while opening the .eps file to in GIMP. Also I have selected "scale fonts by: auto" in the matlab export setup. I use pdf-latex

    0 讨论(0)
  • 2021-01-04 13:59

    I commonly use both Matlab plots in Latex documents. What I usually use is .eps format, is a vector format that Matlab can export quite good. You should edit the most of it that you can in Matlab, with code or manual in the plot. Then just go File -> export setup and click 'expand axes to fill figure', configure whatever you want and export to .eps, then you can import the image to any vector based software, Inkscape or Adobe Illustrator to do final adjustments if needed. Just bump the eps into Latex, it works perfect. Also pdflatex usually converts EPS to PDF, so you can convert it to PDF before from Inkscape or Illustrator if you want to save time.

    0 讨论(0)
  • 2021-01-04 14:00

    I currently use the FEX package plot2svg to accomplish the task you are mentioning.

    It is quite easy to use: after you have added the folder containing the script to your matlab path you can just do

      plot2svg('myplot.svg',gcf);
    

    to save your current figure in svg. (of course you can change gcf (= GetCurrentFigure) to another handle to save other opened figures.)

    Indeed, this is the only way I found to export in vector way plots generated by the PDE toolbox.

    0 讨论(0)
提交回复
热议问题