使用 pgfplots 在外部图上绘制刻度

使用 pgfplots 在外部图上绘制刻度

gnuplot我使用绘制了轮廓/表面图set pm3d map,并想通过 包含此图片\addplot graphics {...};

当我将环境的绘图区域axis与 gnuplot 图片的绘图范围相匹配时,pgfplots 的刻度位于绘图的“后面”,因此不再可见。

是否有可能在前台绘制坐标系,或者我必须将刻度转到图的外面?


代码的相关部分应该是:

\begin{tikzpicture}
  \def\w {0.4*\textwidth};
  \begin{axis}[
      scale only axis,
      width = \w,
      height = \w,
      xmin = 0.4,
      xmax = 0.9,
      ymin = -22.5,
      ymax = 202.5,
      scaled ticks = false,
      xtick = {0.4,0.5,0.6,0.7,0.8,0.9},
      xticklabels = {0.4,0.5,0.6,0.7,0.8,0.9},
      xlabel = $\omega/\omega_p$,
      ytick = {0,45,...,180},
      yticklabels = {$0$,$\frac{\pi}{4}$,$\frac{\pi}{2}$,$\frac{3\pi}{4}$,$\pi$},
      ylabel = angle $\varphi$ around center of sphere
      ]
    \addplot graphics[
        xmin = 0.4,
        xmax = 0.9,
        ymin = -45,
        ymax = 225,
        xtick = {0.4,0.5,0.6,0.7,0.8,0.9},
        ] {data/half.png};
  \end{axis}
\end{tikzpicture}

答案1

PGFPlots 既有分层系统,也有绘制顺序系统。该选项axis on top绘制轴线并在图形区域上打勾。

相关内容