我的 pgfplot 延伸到我的 latex 页面的最右边

我的 pgfplot 延伸到我的 latex 页面的最右边

这是我的代码:

\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}

在此处输入图片描述

相关内容