8 ms·
Gnuplot is designed to work with LaTeX. If you want a unified appearance, with textual elements on the graph typeset by TeX, then that workflow is built-in to g
by leephillips 10y ago
Gnuplot is designed to work with LaTeX. If you want a unified appearance, with textual elements on the graph typeset by TeX, then that workflow is built-in to gnuplot.
You can also use TikZ to call gnuplot from within the LaTeX document, or generate TikZ code from within gnuplot.
A very brief introduction:
https://lwn.net/Articles/628537/ https://lwn.net/Articles/628537/
- davrosthedalek 10y agoI have yet to see a solution that beats gnuplot+tikz+LaTex in image quality. It's also trivial to script and include in a makefile. If you drive it to extremes, this is also the only solution I know of that can do proper references inside the figure key, for example a citation with bibtex. (But beware: this is too much for most publishers)
- leephillips 10y agoThat is extreme - but a nice example of the implications of tight LaTeX integration!
- gjulianm 10y agoGood thing is that you don't even need a Makefile. If you use latexmk it can automatically run gnuplot [1]. It's very useful if you are in "continuous-preview" mode (aka automatic builds when you change the source of the document). http://tex.stackexchange.com/questions/106512/gnuplot-in-latex-without-gnuplottex http://tex.stackexchange.com/questions/106512/gnuplot-in-lat...
- davrosthedalek 10y agoI was aware of latexmk, but I didn't know it can run gnuplot too. That's great! Thanks!
- filmor 10y agoYou don't even need that, if you allow shell-escapes you can run gnuplot directly from your latex call.
- danieldk 10y agoorg-mode is also worth looking into. You can execute code fragments and embed the results using Babel[1]. Makes it simple to use the output of e.g. gnuplot or matplotlib. I am relatively new to org-mode (via Spacemacs). But I really like it, you can use it as a quick notebook to jot down things, run code, and export the result as PDF per LaTeX. [1] http://orgmode.org/worg/org-contrib/babel/ http://orgmode.org/worg/org-contrib/babel/
- MJSplot_author 10y agoThere is another solution for having citations and references in figures: use Inkscape as suggested in the OP. In particular the save to pdf+latex feature. Any text elements in the figure are generated using latex. This means the correct font and the ability to write any latex you want as text. I still like hand editing figures to add complex annotations so I like being able to use Inkscape's GUI.
- semi-extrinsic 10y agoYou can also use PGFPlots, a plotting tool built into LaTeX (using PGF/Tikz). http://pgfplots.sourceforge.net/ http://pgfplots.sourceforge.net/ It delivers nice vector graphics plots, and since it's in your .tex file, it automatically picks up any and all styling changes you have made in the preamble. You can have it re-render plots on each LaTeX compilation, or just conditionally re-render plots if the data has changed. (As always, latexmk [ http://mg.readthedocs.io/latexmk.html http://mg.readthedocs.io/latexmk.html ] comes highly recommended for automating the compilation of LaTeX documents.)
- JohnHammersley 10y agoThere's also a nice gallery of online pgfplot examples at http://pgfplots.net http://pgfplots.net
- widdma 10y agoI'd second the PGFPlots recommendation. Easy to create plots by hand or you can use matlab2tikz (mentioned but dismissed in the article) if you're coming from matlab. I'd also second the latexmk recommendation!
- tjl 10y agoI love matlab2tikz. I used it for all my plots in my Ph.D. thesis (and I had a lot). I also really like latexmk. For non-plots I love Sketch (http://sketch4latex.sourceforge.net http://sketch4latex.sourceforge.net) which is pretty great for doing diagrams with 3D objects, especially if you use the sketch-lib (https://alexdu.github.io/sketch-lib/ https://alexdu.github.io/sketch-lib/) which provides a bunch of useful simple objects to manipulate.
- Y_Y 10y agoGnuplot is something i categorise with Fortran and hand writing latex as "I use use it because my advisor used it, and he used it because his advisor used it...". I understand that they were once the best tool for the job and they still work, but better alternatives have emerged since, e.g. matplotlib, C++/numpy and LyX respectively. I know this is a subjective matter but i feel it's a shame that a lot of scientist don't shop around and hence end up stuck with the "classical" option.
- sn41 10y agoStrange. I feel going in the opposite direction. Removing as many fancy latex packages from my documents as possible, because I am worried that my files can't be compiled 10-15 years from now. I am a tex/latex survivalist :)
- davrosthedalek 10y agoThe good thing about latex is that it's pure text. While the ability for nice output might be lost, generally, the intent and content of the document is still extractable.
- leephillips 10y agoI "shopped around" and tried all of these things, and more. I returned to LaTeX and gnuplot because they are better. I'd certainly rather use modern array Fortran than C++.
- davrosthedalek 10y agoLet's put it this way: I wrote my diploma thesis in LyX, but went back to emacs+latex for my PhD. I did not regret it. Matplotlib is close, but I get results with gnuplot quicker. My students all started out using root/matlab/whatever for plots. Except for the matlab guy, sooner or later, they all switched to gnuplot. Not forced by me.
- Y_Y 10y agoSo you shopped around and stuck with the thing you like. That's great and nobody could argue with it. In my own department grad students and even wizened old professors are moving away from gnuplot and matlab to matplotlib, but I bet that having "experts" around is a more important factor than anything else.