使用“轮廓 gnuplot”和“轴线 = 中间”时不显示刻度标签

使用“轮廓 gnuplot”和“轴线 = 中间”时不显示刻度标签

以下代码是@user121799修改后的答案TikZ:绘制轮廓线。不同之处在于我axis x line = middle, axis y line = middle在第一行环境中axis添加了

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.16} 
\begin{document}
\begin{tikzpicture} \begin{axis}[
    axis x line = middle, axis y line = middle,
    title={$x^2-x\,y$},
    enlarge x limits,
    view={0}{90},
    xlabel=$x$, ylabel=$y$,
    small,
]
\addplot3[domain=-3:3,
        domain y=-3:3,
        contour gnuplot={levels={-1,1},labels=false},
        thick,samples=50,samples y=50,
    ] {x^2-x*y};
\end{axis}
\end{tikzpicture}
\end{document}

当我运行时,刻度标签不再显示。是什么原因造成的?

在此处输入图片描述

答案1

替换axis x line = middle, axis y line = middle,axis lines = middle,。(我无法解释为什么您的版本不起作用。)

在此处输入图片描述

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.16} 
\begin{document}
\begin{tikzpicture} \begin{axis}[
    axis lines = middle,
    title={$x^2-x\,y$},
    enlarge x limits,
    view={0}{90},
    xlabel=$x$, ylabel=$y$,
    small,
]
\addplot3[domain=-3:3,
        domain y=-3:3,
        contour gnuplot={levels={-1,1},labels=false},
        thick,samples=50,samples y=50,
    ] {x^2-x*y};
\end{axis}
\end{tikzpicture}
\end{document}

相关内容