Friday, June 7, 2013

Reverse xaxis on polar plot

Reverse xaxis on polar plot

I'm tring to obtain a clockwise polar plot, keeping the zero in north direction. The plot is correctly displayed but I can't fix the xtick style.
\documentclass[10pt,border=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usetikzlibrary{shapes.geometric}

\makeatletter
\def\pgftransform@angle{0}
\pgfplotsset{
    xticklabel style={
        inner xsep= 1pt,
        circle,
        anchor=-\tick+(\pgftransform@angle)
    },
    yticklabel style={
        anchor = 90 + \pgftransform@angle
    }
}
\makeatother

\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
    x dir = reverse,
    xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
    xtick={0,30,...,330},
    rotate=-90]
\addplot table{
    0 1
    30 2
    60 4
    90 6
    120 4
    };
\end{polaraxis}
\end{tikzpicture}
\end{document}
Here's my output.

No comments:

Post a Comment