我有以下设置:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usetikzlibrary{3d}
\begin{document}
\begin{tikzpicture}
[x=1.2cm,y=1.2cm,z=0.5cm,scale=1.0,>=stealth]
% Grid
\begin{scope}[canvas is xz plane at y=0]
\draw [black!20] (-2.5,-2.5) grid (2.5,2.5);
% Axis ticks
\foreach \c in {1,2,...,2}
{\node[] at (-\c,-0.4) {\footnotesize $-$\c};}
\foreach \c in {1,2,...,2}
{\node[] at (\c,-0.3) {\footnotesize \c};}
\foreach \c in {1,2,...,2}
{\node[] at (-0.3,-\c) {\footnotesize $-$\c};}
\foreach \c in {1,2,...,2}
{\node[] at (-0.3,\c) {\footnotesize \c};}
\end{scope}
% The axes
\draw[->, thick] (xyz cs:x=-2.5) -- (xyz cs:x=2.5) node[right] {$x$};
\draw[->] (xyz cs:z=-2.5) -- (xyz cs:z=2.5) node[above] {\small $y$};
\draw[-] (xyz cs:y=-2.3) -- (xyz cs:y=2.3) node[above] {};
\end{tikzpicture}
\end{document}
我们可以画一个3D 曲线喜欢
\addplot3[variable=t,mesh,domain=0:1] (t^2,{ t*(1-t)}, 1-t);
但没有使用axis
环境?也许有其他东西可以代替addplot3
?
更新:我想到了:我们只需要draw + plot
像这样使用
\draw[solid, red] plot[domain=-1:1, samples=200, smooth]
({\x*\x-1},{4*\x*cos(90*\x)},{-\x});
就这样 :)