I have managed to use pgfplots' gnuplot option to solve an implicit equation:
\documentclass{standalone}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[
xmin=8e2,
xmax=1e8,
ymin=0.008,
ymax=0.1
]
\addplot[solid,raw gnuplot] gnuplot {
set xrange [2300:1e8];
set yrange [0.008:0.1];
set logscale xy;
set samples 100;
f(R,L) = -2*log10(2.51/(R*sqrt(L))+4e-3/3.71)-1/sqrt(L);
set cont base;
set cntrparam levels discrete 0;
unset surface;
splot f(x,y)
};
\end{loglogaxis}
\end{tikzpicture}
\end{document}
The problem here is that gnuplot doesn't sort the result, so that the plot appears closed. How can I sort the data generated by gnuplot before it is plotted by pgfplots?
I have tried to pass table sorting options to gnuplot:
\addplot[...] gnuplot[sort=true,sort cmp={float <}] {...};
which didn't work.
My other idea was to call gnuplot from my tex document without plotting immediately. I could then read the data with pgfplotstable and process it, but I don't know a convenient way to call gnuplot. My goal is to generate a number of plots in one axis environment only with one call to pfdlatex.
I noticed that pgfplots 1.5.1 does not close the plot, but pgfplots 1.4.1 does. However, the coordinates are still not sorted and the nodes current plot end and current plot begin are at the same coordinate (which is bad in my case).
(current plot end)should refer. – Jake Feb 11 '12 at 11:41pgfplotsinterpret contour plots made with gnuplot as contour plots at all? – Christoph Feb 13 '12 at 08:29