我正在学习如何gnuplot
使用TikZ
。
我想绘制一些代数曲线的相邻图形。我从可以不使用 gnuplot 绘制的图形开始(它们不是隐式的)。我想在它们旁边绘制一条具有相同样式的隐式曲线(相同轴、居中和)ultra thick
。
以下是我迄今为止所取得的成就。
\documentclass{standalone}
\usepackage{tikz}
\usepackage{gnuplot-lua-tikz}
\usepackage[shell]{gnuplottex}
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
\def\sizeGraph{1.3}
\draw[domain=-0.91:0.91, smooth, variable=\x, red, ultra thick] plot ({\x}, {sqrt(1-\x*\x)});
\draw[domain=-1:-0.9, smooth, variable=\x, red, ultra thick] plot ({\x}, {sqrt(1-\x*\x)});
\draw[domain=0.9:1, smooth, variable=\x, red, ultra thick] plot ({\x}, {sqrt(1-\x*\x)});
\draw[domain=-0.91:0.91, smooth, variable=\x, red, ultra thick] plot ({\x}, {-sqrt(1-\x*\x)});
\draw[domain=-1:-0.9, smooth, variable=\x, red, ultra thick] plot ({\x}, {-sqrt(1-\x*\x)});
\draw[domain=0.9:1, smooth, variable=\x, red, ultra thick] plot ({\x}, {-sqrt(1-\x*\x)});
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-\sizeGraph) -- (0,\sizeGraph) node[above] {$y$};
\node [below=1.5cm, align=flush center]
{
$V(X^2+Y^2-1)$
};
\end{tikzpicture}
\qquad
\begin{tikzpicture}
\def\sizeGraph{1.3}
\draw[samples=1000, domain=-\sizeGraph:\sizeGraph, smooth, variable=\x, blue, ultra thick] plot ({\x}, {\x*\x});
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-1.3) -- (0,1.3) node[above] {$y$};
\node [below=1.5cm, align=flush center]
{
$V(Y-X^2)$
};
\end{tikzpicture}
\qquad
\begin{tikzpicture}
\def\sizeGraph{1.3}
\draw[samples=1000, domain=-\sizeGraph:\sizeGraph, smooth, variable=\x, orange!60!black, ultra thick] plot ({\x}, {\x});
\draw[samples=1000, domain=-\sizeGraph:\sizeGraph, smooth, variable=\x, orange!60!black, ultra thick] plot ({\x}, {-\x});
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-1.3) -- (0,1.3) node[above] {$y$};
\node [below=1.5cm, align=flush center]
{
$V(Y^2-X^2)$
};
\end{tikzpicture}
\quad
\begin{tikzpicture}
\def\sizeGraph{1.3}
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-1.3) -- (0,1.3) node[above] {$y$};
\begin{gnuplot}[terminal=tikz,terminaloptions={size 8,8}]
set contour
set cntrparam levels incremental 0.0001, 0.0001, 0.0001
set view map
set view equal
unset surface
unset key
unset tics
unset border
set lmargin at screen 0
set rmargin at screen 1
set bmargin at screen 0
set tmargin at screen 1
set isosamples 1000,1000
set xrange [-3.5:3.5]
set yrange [-3.5:3.5]
set view 0,0
set cont base
splot x**3 + y**3 - 6*x*y
\end{gnuplot}
\end{tikzpicture}
\end{document}
你能帮助我吗?
答案1
我提出以下不使用的解决方案gnuplot
。我希望你不会无条件地爱上它。
它仅使用 TikZ 和奇异立方的参数化。
参数化是通过将曲线从原点投影到直线上获得的x+y=1.我们得到 (x,y)= 6t/(1+t^3)(1,t)。
在绘画过程中我们必须做出一些选择,因为吨不同于-1。这就是四个命令的原因\draw
。不过它们可能会变成两个。
您的轴对于系数来说太小6在三次方程中。因此,我缩小了曲线以使有趣的部分适合所需的矩形。
\documentclass[11pt, border=.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, math}
\begin{document}
\tikzmath{%
real \sizeGraph;
\sizeGraph = 1.4;
}
\begin{tikzpicture}
\draw[domain=-0.91:0.91, smooth, variable=\x, red, ultra thick]
plot ({\x}, {sqrt(1-\x*\x)});
\draw[domain=-1:-0.9, smooth, variable=\x, red, ultra thick]
plot ({\x}, {sqrt(1-\x*\x)});
\draw[domain=0.9:1, smooth, variable=\x, red, ultra thick]
plot ({\x}, {sqrt(1-\x*\x)});
\draw[domain=-0.91:0.91, smooth, variable=\x, red, ultra thick]
plot ({\x}, {-sqrt(1-\x*\x)});
\draw[domain=-1:-0.9, smooth, variable=\x, red, ultra thick]
plot ({\x}, {-sqrt(1-\x*\x)});
\draw[domain=0.9:1, smooth, variable=\x, red, ultra thick]
plot ({\x}, {-sqrt(1-\x*\x)});
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-\sizeGraph) -- (0,\sizeGraph) node[above] {$y$};
\node[below=1.5cm, align=flush center] {$V(X^2+Y^2-1)$};
\end{tikzpicture}
\qquad
\begin{tikzpicture}
\draw[samples=1000, domain=-\sizeGraph:\sizeGraph, smooth,
variable=\x, blue, ultra thick] plot ({\x}, {\x*\x});
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-\sizeGraph) -- (0,\sizeGraph) node[above] {$y$};
\node [below=1.5cm, align=flush center]{$V(Y-X^2)$};
\end{tikzpicture}
\qquad
\begin{tikzpicture}
\draw[samples=1000, domain=-\sizeGraph:\sizeGraph, smooth,
variable=\x, orange!60!black, ultra thick] plot ({\x}, {\x});
\draw[samples=1000, domain=-\sizeGraph:\sizeGraph, smooth,
variable=\x, orange!60!black, ultra thick] plot ({\x}, {-\x});
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-\sizeGraph) -- (0,\sizeGraph) node[above] {$y$};
\node [below=1.5cm, align=flush center] {$V(Y^2-X^2)$};
\end{tikzpicture}
\quad
\tikzmath{%
integer \N{-}, \N{+}, \j;
\N{-} = 21;
\N{+} = 22;
}
\begin{tikzpicture}
\begin{scope}[red, ultra thick, scale=.4]
\draw (0, 0)
\foreach \i [evaluate=\i as \j using \i/20] in {1, ..., \N{+}}{%
-- (${1/(1+\j^3)*(6*\j)}*(1, \j)$)
};
\draw (0, 0)
\foreach \i [evaluate=\i as \j using -\i/40] in {1, ..., \N{-}}{%
-- (${6*\j/(1+\j^3)}*(1, \j)$)
};
\draw (0, 0)
\foreach \i [evaluate=\i as \j using \i/20] in {1, ..., \N{+}}{%
-- (${1/(1+\j^3)*(6*\j)}*(\j, 1)$)
};
\draw (0, 0)
\foreach \i [evaluate=\i as \j using -\i/40] in {1, ..., \N{-}}{%
-- (${6*\j/(1+\j^3)}*(\j, 1)$)
};
\end{scope}
\draw[->] (-\sizeGraph,0) -- (\sizeGraph,0) node[right] {$x$};
\draw[->] (0,-\sizeGraph) -- (0,\sizeGraph) node[above] {$y$};
\node [below=1.5cm, align=flush center] {$V(X^3+Y^3-6XY)$};
\end{tikzpicture}
\end{document}