115 points · by JohnHammersley · 9y ago · 57 comments
You can also use TikZ to call gnuplot from within the LaTeX document, or generate TikZ code from within gnuplot.
A very brief introduction:
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 ] comes highly recommended for automating the compilation of LaTeX documents.)
I'd also second the latexmk recommendation!
For non-plots I love Sketch (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/) which provides a bunch of useful simple objects to manipulate.
http://tex.stackexchange.com/questions/106512/gnuplot-in-lat...
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.
If a hypothetical Fortran 201x added Python-esque generic lists and list/array comprehensions that played well with strings, and promoted strings to a "first class" type, I'd have a lot less reason for pulling in Python for scientific applications not involving web/graphics.
All the same your comment makes me think I may have dismissed it too quickly so I'm going to give it another try for my next toy project (even if they index arrays from 1). Thank you.
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.
I am a tex/latex survivalist :)
Example A of the wrong type of figure for any possible context: 3-dimensional pie charts.
Most pie charts are terrible as well, it's very hard to compare the sizes of slices. There's a good piece on pie charts at http://www.businessinsider.com/pie-charts-are-the-worst-2013... with a quote from Edward Tufte: "Pie chart users deserve same suspicion+skepticism as those who mix up its/it's, there/their.To compare,use little table, sentence, not pies."
The combination, especially when used for a publication, is just a disaster.
[1] http://journals.plos.org/plosone/article?id=10.1371/journal....
I have created some high quality, complex plots out through matlabl2tikz with no problem. I haven't had the issues the author notes and I'd suggest they file a bug report. The m2t community is active and friendly.
The other bonus of m2t is you can edit the files in PGFplots, which is a powerful and complete language/library. For my use case, it was important that my plots be repeatable, so manually doing it with Inkscape would be tedious. Having easily editable source code allowed me to write scripts to filter the output to what I needed.
The one problem I did find is that pgfplots can be quite slow. This isn't m2t's fault though and can be overcome with TikZ's cache system.
Disclosure: I wrote the path simplification in matlab2tikz, but nothing else.
But everything in MATLAB, then I just symlink the pdf figures to the manuscript folder, so with an F5 in MATLAB and a build in Sublime I have the manuscript updated.
Its a very manual process though, but I think the graphics that come out of it seem to be nicer than Matplotlib, and Matlab can do. Am I crazy, or should I really consider something like this?
The proof of concept worked well for line and contour plots, but my thesis got in the way of completing this.
Actually, a quick search yielded [2], so it appears that ggplot2 is supported as well. And apparently supported in one of the knitr examples [3] (if you use knitr, which I highly recommend).
[1] https://cran.r-project.org/web/packages/tikzDevice/index.htm...
[2] http://iltabiai.github.io/tips/latex/2015/09/15/latex-tikzde...