Actually, it is possible to draw implicit functions with LaTeX, if not with PGFPlots… but also in that case you need to cheat a little. Dan Luecking has implemented in its mfpic
package, which is a (La)TeX interface to MetaPost (or METAFONT), a macro called
\levelcurve[spec]{seed,step} {inequality}
,
which works quite well beyond certain conditions, as said in the documentation, p. 44-45:
This figure macro produces a level curve of some function F(x;y)
. There are three requirements
on the parameters for this to work correctly. First, in order to obtain the curve satisfying F(x;y) =C
,
the {inequality}
must be either {F(x,y) > C}
or {F(x,y) < C}
. Second, the level curve must
surround the point given by the seed
paramter, and third, the inequality must be true at this seed
point.
The command works by searching rightward from seed
until it encounters the first point on
the level curve. It then tries to find a nearby point on the level curve and joins it to the first one, and
continues similarly until it finds it has returned near the starting point. The meaning of “nearby point
on the level curve” is the intersection of the level curve with a circle of radius step
centered at the
previously found point. If the region defined by the inequality extends beyond the bounds of the
picture (as set by the \mfpic command), the region is truncated and the resulting curve will follow
along the picture’s border.
I've already used this macro to answer a similar question, and it worked very well in that case. I've just applied it on your simple example:
\documentclass{standalone}
\usepackage{amsmath}
\usepackage[metapost]{mfpic}
\setlength{\mfpicunit}{1cm}
\opengraphsfile{\jobname}
\begin{document}
\begin{mfpic}[2]{-0.5}{2}{-0.5}{2}
\levelcurve[p]{(0, 0), 0.01}{3*x + 2*y - 2 < 0}
\doaxes{xy}
\tlpointsep{2bp}
\tlabels{[tr](0, 0){$O$} [tr](0.667, 0){$\dfrac{2}{3}$} [cr](0, 1){$1$}
[tc](\xmax, 0){$x$} [cr](0, \ymax){$y$}}
\end{mfpic}
\closegraphsfile
\end{document}
Typeset with LaTeX, then with MetaPost, and then with LaTeX again. The result is:
(As indicated in the documentation, the borders of the graph have been used to close the line which was the expected result.)
Still, as Paul Gessler noticed, an external program has worked behind the scene, namely MetaPost (be it as close to LaTeX as an external program can be).
\addplot3[mesh,samples=10,domain y=-6:4]{3*x + 2*y - 2};
now. I get a 3D plot with intersecting planes (there is another similar function that isn't in the MWE). I'm tinkering with the view settings to see if that gives me what I want, but still no luck.gnuplot
, you can try to usesagetex
too.TikZ
/pgfplots
guru, so you'll just have to wait for the cavalry.:-)
Is there a reason you want to avoidgnuplot
though.? As far as I know, all the call tognuplot
does is export a data file that is plotted bypgfplots
. So the plot you'd get would be identical to one produced directly withpgfplots
internals.pgfplots
usesgnuplot
internally to generate the data points for the contour. If memory serves me right, the command you are looking for is\addplot3[contour gnuplot,...]
.