I'm using Matlab to get figures from data produced with Fortran calculations and I was wondering if it's better to produce them directly with Matlab (I use the .pdf format) or export them with Matlab2tikz and then process them with the tikZ/pgfplots packages directly on overleaf. Of course I need a very good graphical output and the overleaf compilation to be fast.
Asked
Active
Viewed 427 times
0

samcarter_is_at_topanswers.xyz
- 33,336
- 5
- 41
- 62

g_don
- 195
- 1
- 9
-
1pdf will be faster, but by using tikz you will automatically get matching fonts to the rest of your document. – samcarter_is_at_topanswers.xyz Jan 16 '22 at 23:10
1 Answers
2
A solution that allows both perfect graphical output and fast compilation is to export your graph with Matlab2tikz, compile it separately in a standalone
documentclass, like this:
\documentclass{standalone}
...
\begin{document}
\begin{tikzpicture}
...
\end{tikzpicture}
\end{document}
and then include the resulting .pdf in your main document with:
\includegraphics{mygraph.pdf}
You don't have to compile your main document twice for this, of course you have to compile the standalone document before.
As samcarter already said in their comment, the advantage of having TikZ is that you can have the same fonts as the rest of your document. So your document will look high-quality.
The disadvantage is that compilation time gets longer if you have a lot of TikZ pictures and compile them directly in your document.

CarLaTeX
- 262
- 4
- 17
-
Thanks @CarLaTeX. In this way, Do I have compile twice my project? Then I would like to know advantages of using tikZ/pgfplots wrt matlab. – g_don Jan 17 '22 at 09:59
-
@Giuseppe The answer is already in your question. However, see my edit. – CarLaTeX Jan 17 '22 at 10:09