I noticed that for values close to 0° and 180° the angular values dramatically changes if the values are imported from cartesian data. Here the code (with cartesian coordinates plotted in polar with data cs=cart and the same coordinates in polar coordinates obtained with arctan2 Matlab function) and illustration:
\documentclass{minimal}
\usepackage{eurosym}
\usepackage{pgfplots}
\usepackage{fp}
\begin{document}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{polar}
\centering
\begin{tikzpicture}
\begin{polaraxis}[
visualization depends on=x \as \pgfplotspointx,
nodes near coords,
every node near coord/.style={
%font=\small,
rotate=\pgfplotspointx,
append after command={
node [
anchor=south,
%font=\small,
rotate=\pgfplotspointx,
shift={(axis direction cs:0,(12.75-\pgfplotspointmeta))}
] {$\pgfmathprintnumber{\pgfplotspointx}^\circ$}
}
},
width=7\textwidth,
xmin=-2,xmax=1, ymin=12, ymax=16,
title=artctan2 precision problem,
grid=both,
minor x tick num={4},
minor y tick num={1},
]
\addplot+[polar comb, data cs=cart, mark size=1, mark=asterisk, color=blue, dashed] table {
14.370195 -0.304948
14.370195 -0.304948
};
\addplot+[polar comb, mark size=1, mark=asterisk, color=green, solid] table {-1.215683667 14.37343027
-1.215683667 14.37343027
};
\end{polaraxis}
\end{tikzpicture}
\end{document}
Has anyone meet this issue?
Thank you in advance.
\pgfmathparse{atan2(14.37,-0.304948)} \pgfmathresult
gives the (almost) correct result of-1.20
. Maybe there's something else at play in the conversion from cartesian to polar coordinates in PGFPlots?