TikZ并没有不推荐使用外部程序,只是说明了使用TikZ作图的优势:一致性
这里使用了`gnuplot`作隐函数图像
![](https://wenda.latexstudio.net/data/attach/200715/ySFH977r.png)
```tex
\documentclass[border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line = middle,
axis y line = middle,
xlabel = {$x$},
ylabel = {$y$},
xmin=-16, xmax=16,
ymin=-12, ymax=7,
legend pos=outer north east,
legend style={draw=none},
]
\addplot +[no markers,
raw gnuplot,
thick,
red,
empty line = jump % not strictly necessary, as this is the default behaviour in the development version of PGFPlots
] gnuplot {
set xrange [-15:15];
set yrange [-11:6];
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 500;
set samples 500;
splot x^2 + x*y + y^3 - 2;
};
\addplot +[no markers,
raw gnuplot,
thick,
blue,
empty line = jump % not strictly necessary, as this is the default behaviour in the development version of PGFPlots
] gnuplot {
set xrange [-15:15];
set yrange [-11:6];
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 500;
set samples 500;
splot exp(sqrt(x)+y) + cos(x) -1/x;
};
\legend{$x^2 + xy + y^3=0$, $\exp(\sqrt{x}+y) + \cos x - 1/x$}
\end{axis}
\end{tikzpicture}
\end{document}
```
一周热门 更多>