Polaraxis 非整列負 yticklabel

Polaraxis 非整列負 yticklabel

dBスケールで極座標をプロットしたいのですが、この場合、正と負の値があります。通常、負の半径は反対方向にプロットされますが、座標の変換望んだ結果が得られます。

しかし、負の目盛りと正の目盛りが完全に揃っていないという問題があります。私は試してみましたヒントしかし、これはオフセットを少しだけ修正するだけです。これは、ソリューションが回転ティックの問題に対して提供されたためである可能性があります。

半径軸の目盛りを正しく揃えるにはどうすればよいですか?

\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}

\begin{document}
\begin{tikzpicture}
  \begin{polaraxis}[%
      xtick={0,30,...,180},
      ymin=-25,
      ymax=10,
      xmax=180,
      y coord trafo/.code=\pgfmathparse{#1+25},
      y coord inv trafo/.code=\pgfmathparse{#1-25},
      xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
      yticklabel style={yshift=-0.5cm},
    ],
    \addplot[%
    ]
    coordinates{%
      (0,-15)
      (30,-5)
      (90,0)
      (120,5)
    };
  \end{polaraxis}
\end{tikzpicture}
\end{document}

答え1

すでに述べたように質問の下のコメント欄に、目盛りラベル完璧に整列しています。詳細については、コード内のコメントを参照してください。

\documentclass{standalone}
\usepackage{pgfplots}
    \usepgfplotslibrary{polar}
\begin{document}
    \begin{tikzpicture}
        \begin{polaraxis}[
            ymin=-25,
            ymax=10,
            xmax=180,
            % when you have at PGFPlots v1.13 you can use the `xtick distance' feature
%            xtick={0,30,...,180},
            xtick distance=30,
            y coord trafo/.code=\pgfmathparse{#1+25},
            y coord inv trafo/.code=\pgfmathparse{#1-25},
            xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
            yticklabel style={
                % draw a frame around the tick labels to see, that they are
                % indeed centered
                draw=red,
                % (and use there is a better way to position the tick labels
                % on the other side of the axis ...)
%                yshift=-0.5cm,
                anchor=near yticklabel opposite,
            },
        ],
            \addplot coordinates {
                (0,-15) (30,-5) (90,0) (120,5)
            };
        \end{polaraxis}
    \end{tikzpicture}
\end{document}

上記コードの結果を示す画像

関連情報