![我的 pgfplot 延伸到我的 latex 页面的最右边](https://linux22.com/image/414851/%E6%88%91%E7%9A%84%20pgfplot%20%E5%BB%B6%E4%BC%B8%E5%88%B0%E6%88%91%E7%9A%84%20latex%20%E9%A1%B5%E9%9D%A2%E7%9A%84%E6%9C%80%E5%8F%B3%E8%BE%B9.png)
这是我的代码:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\vspace{1cm}
\begin{tikzpicture}
\begin{axis}[
view={120}{20},
axis lines=center,
ticks=none,
xmin=-2,xmax=2,ymin=-2,ymax=2, zmin=-2, zmax=2,
xlabel=$y$,
ylabel=$z$,
every axis x label/.style={at={(current axis.right of origin)},anchor=west},
every axis y label/.style={at={(current axis.above origin)},anchor=south},
]
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({-2},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({-1},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({0},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({1},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({2},{x},{-x*x});
\end{axis}
\end{tikzpicture}
\end{document}
这是我的图像。
我做错了什么?我该如何解决?
谢谢。
答案1
这不是一个完整的答案,因为从我的角度来看
我究竟做错了什么?
是
我什么也没看见。
我很好奇这种行为的原因是什么。然而,这篇文章解决了
我怎样才能解决这个问题?
和
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\vspace{1cm}
\begin{tikzpicture}
\begin{axis}[
view={120}{20},
axis lines=center,
ticks=none,
xmin=-2,xmax=2,ymin=-2,ymax=2, zmin=-2, zmax=2,
xlabel=$y$,
ylabel=$z$,
every axis x label/.style={at={(current axis.east|-current axis.origin)},anchor=west},
every axis y label/.style={at={(current axis.north-|current axis.origin)},anchor=south},
]
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({-2},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({-1},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({0},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({1},{x},{-x*x});
\addplot3 [blue, thick, samples=100, samples y=0, domain=-2:2] ({2},{x},{-x*x});
\end{axis}
\end{tikzpicture}
\end{document}