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 to inset that plots into LaTeX document.
The only thing, I have found so far is a plugin from mathworks and the answer from stackexchange , but this looks rather too complicated
There is also matlab2tikz and matlabfrag which exports to eps with annotation for importing to LaTeX.
Here is an example of mine where I've used matlabfrag.
I've also discussed this with a Mathworks engineer, who agreed that there is not a nice-and-ready tool for this kind of thing, because everybody wants to do different things with it (I already mention two different LaTeX approaches). So imo the best thing to do is to play around with different tools and see which suits you best.
Most of the times I had to tinker a lot with the axes, font size of labels, etc to get it exactly how I wanted (btw adjusting a legend is the greatest hell).
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.
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:
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