I am writing a fairly large article with a lot of different plots.
They range from simple ones like
x^2 to high-polynomials with their first and second derivative, and nonlinearities (sigmoid, tan, etc.). Sometimes they are also in 3 dimensions.
I am using pgfplot within tikzpicture and then gnuplot. For the easy plots, this is straightforward. However, the more complex plots (that may include non-continuity points), the gnuplot expression becomes harder and harder to understand and maintain. For some plots, I need randomly created points anyway (created once, and then fixed), which need to be "classified" according to a function.
For all plots, I have (or could create) Python scripts to output a coordinates table that would be possible to use within the pgfplot table import functionality. This may seem overkill for x^2 but is really necessary for the more complex plots. And with the higher polynomials, I don't have to do the derivates manually.
This works for plots that are points or lines in 2D but not in 3D because the number of points for the imported table exceeds LaTeX's memory (x and y have 1000 samples each, which results in 1,000,000 coordinates).
As I have the functions in Python anyway, I could also use matplotlib (or seaborn, etc.) to create pdfs with the plot. This has the disadvantage that the plots do not look like they would when drawing with LaTeX/gnuplot (different colors, styles, etc.), so I would have to maintain the styles in two different places.
Is there a best practice for this type plotting? I want one type of plot (either only gnuplot or only Python) and not a mixture of different methods.
pgfbackend. ፨ In line of principals, the typesetting being delegated to TeX, you'd get a consistent look between plots and text — that said I have not a first hand experience and consequently I cannot give you a real answer.
pgf cacheand the first outcome is
https://github.com/dionhaefner/pgfcache፨ I have no idea if it it can help you but I'd have a look if I were in your shoes.