gnuplot 中的标签定位

gnuplot 中的标签定位

我希望将 x 和 y 标签放在轴末端,靠近箭头:

\documentclass{scrbook}

\usepackage{tikz,pgfplots}

\begin{document}

  \begin{tikzpicture}[thick,scale=0.7, 
      every node/.style={transform shape} ]

    \begin{axis}[
      xmin = -5, xmax = 5, ymin = -5, ymax = 5,  % osy
      axis equal image,
      axis x line = middle,
      axis y line = middle,
      xlabel={$x$}, ylabel={$y$},
      ]

      \addplot[color=red, samples=100, smooth, ultra thick, unbounded coords=jump, no markers, 
               domain = -4:4] gnuplot{x*x*x-x};

    \end{axis}
  \end{tikzpicture}
\end{document}

答案1

欢迎使用 TeX.SX!只需添加一行\pgfplotsset{compat=1.15},一切正常:

\documentclass{scrbook}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.15}

\begin{document}

  \begin{tikzpicture}[thick,scale=0.7, 
      every node/.style={transform shape} ]

    \begin{axis}[
      xmin = -5, xmax = 5, ymin = -5, ymax = 5,  % osy
      axis equal image,
      axis x line = middle,
      axis y line = middle,
      xlabel={$x$}, ylabel={$y$},
      ]

      \addplot[color=red, samples=100, smooth, ultra thick, unbounded coords=jump, no markers, 
               domain = -4:4] gnuplot{x*x*x-x};

    \end{axis}
  \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容