极地pgfplots径向轴刻度标签

极地pgfplots径向轴刻度标签

我想在极坐标图上叠加笛卡尔坐标轴。垂直轴位于极坐标径向(水平)刻度标签的顶部。我该如何移动刻度标签,使它们位于水平轴下方或不妨碍视线?

Notice "t" axis overlaying "0"

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.polar} 

\begin{document}
\begin{tikzpicture}
  \begin{polaraxis}[axis on top, xticklabel=$\pgfmathprintnumber{\tick}^\circ$]
    \addplot[fill=green!40,draw=none,domain=-60:60]{1};
    \coordinate (origin) at (axis cs:0,0);
  \end{polaraxis}
  \draw[thick,blue,-stealth] (origin) -- +(0,1) node [above right] {$t$};
  \draw[thick,blue,-stealth] (origin) -- +(1,0) node [midway, above] {$s$};
\end{tikzpicture}
\end{document}

答案1

您可以通过设置来更改刻度线的对齐方式ytick align=outside,并通过设置来调整刻度标签的位置yticklabel style={ anchor=north, yshift=-2*\pgfkeysvalueof{/pgfplots/major tick length} }

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.polar} 

\begin{document}
\begin{tikzpicture}
  \begin{polaraxis}[
    axis on top,
    xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
    ytick align=outside,
    yticklabel style={
        anchor=north,
        yshift=-2*\pgfkeysvalueof{/pgfplots/major tick length}
    }
    ]
    \addplot[fill=green!40,draw=none,domain=-60:60]{1};
    \coordinate (origin) at (axis cs:0,0);
  \end{polaraxis}
  \draw[thick,blue,-stealth] (origin) -- +(0,1) node [above right] {$t$};
  \draw[thick,blue,-stealth] (origin) -- +(1,0) node [midway, above] {$s$};
\end{tikzpicture}
\end{document}

相关内容