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}

위 코드의 결과를 보여주는 이미지

관련 정보