如何更改繪圖中的軸?

如何更改繪圖中的軸?

我用從 sourceforge.net 複製的程式碼繪製了表面。我想更改給定的軸標籤,無論如何,當將其合併到 tex 文件中時,軸標籤都無法正確呈現。我希望我的軸能夠描述所有點都低於 x=0 的事實。同樣,如果我繪製

\addplot3[surf] {-x^2 - y^2}

我希望它顯示所有點都高於 z=0。到目前為止,我的諮詢 pgfmanual.pdf 沒有幫助。我還希望能夠縮放繪圖(增加或減少其大小)。

\documentclass[11pt,twoside]{report}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, decorations.pathreplacing, matrix}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}

\addplot3[surf] {-x^2 - y^2};
\end{axis}
\end{tikzpicture}
\end{document}

答案1

希望您同時找到了解決方案。如果不 ...

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            % change the width of the plot
            width=7cm,
            % change the `zmin' value
            % (0 makes no sense here, because that is the maximum value
            %  of the given function. That is why I have chosen -10 here.)
            zmin=-10,
        ]
            \addplot3 [surf] {-x^2 - y^2};
        \end{axis}
    \end{tikzpicture}
\end{document}

顯示上述程式碼結果的圖像

相關內容