绘制 f(x,y)=x^2-y^2

绘制 f(x,y)=x^2-y^2

是否可以使坐标轴全部从 -1 到 1,并使图看起来更像立方体?我的代码:

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[
    title={$f(x,y)=x^2-y^2$}, 
    xlabel=$x$, ylabel=$y$, small]
    \addplot3[surf, domain=-1.3:1.3] 
    {x^2-y^2};
    \end{axis}
    \end{tikzpicture}   
\end{document}

答案1

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\pgfplotsset{every axis/.style={scale only axis}}
\begin{document}
    \begin{tikzpicture}
    \begin{axis}[
    title={$f(x,y)=x^2-y^2$}, 
    xlabel=$x$, ylabel=$y$, small,
    xmin=-1, xmax=1,
    ymin=-1, ymax=1,
    zmin=-1, zmax=1,
    3d box=complete,
    unit vector ratio*=1 1 1,
    ]
    \addplot3[surf, domain=-1:1] 
    {x^2-y^2};
    \end{axis}
    \end{tikzpicture}   
\end{document}

在此处输入图片描述

相关内容