[Tex/LaTex] Polar Plot x and y ticks and units

pgfplotsunits

I'm having some trouble with polar plots. I generate the plot coordinates using Scilab and then plot them in Latex. I can't figure out how to remove the points (mark = \empty does nothing, but changing the mark with mark=x for example does nothing either), nor can I move the ticks out of the picture. Can anyone help please?

I want to add units to the ticks as well, degrees for the x ticks and dB for the y ticks.

My code is as follows:

\begin{tikzpicture}
\begin{polaraxis}[xmin=-90,xmax=90,rotate=90]
    \addplot table [x index=0, y index=1,col sep = comma, data cs=polarrad,mark = \empty]{mydata05.csv};
\end{polaraxis}
\end{tikzpicture}

Polar plot

Best Answer

As John said, you can remove the points by using the key no markers in the polaraxis options (or in the \addplot options if you only want to remove the marks for a single plot).

For moving the tick marks out the axis, you can put the following code snippet in your preamble, which will make sure that the labels are placed properly regardless of the axis rotation (\pgftransform@angle is a key that is set whenever rotate=<angle> is called):

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

For the degree symbol, you can use the approach from your other question (Polar plots, add degree symbol and hide the radius axis labels), as Christian mentioned.

(And the same axis with rotate=35)

\documentclass[10pt,border=10pt]{standalone}

\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usetikzlibrary{shapes.geometric}

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

\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[xmin=-90,xmax=90,rotate=90,
    domain=-90:90,
    xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
    no markers]
    \addplot +[orange, thick, smooth] {cos(x)};
\end{polaraxis}
\end{tikzpicture}
\end{document}