[Tex/LaTex] Polar plot using pgfplots/tikz

pgfplotspolarplottikz-pgf

I would like to reproduce the figure below using pgfplots/tikz packages on Latex. I am sharing with you a .csv file to plot a similar figure. It is important to notice that y-axis are outside the plot (left side) and there are negative and positives values for radius (y-values). I've already spent a lot of time looking for a good result but I did not find anyone doing such thing. This figure is related to antenna topics.

Would someone help me on this?
You can consider the y-axis part as an extra point! The diagram is already a huge contribution.

Thanks in advance

csv-file link
Consider the first columns as the angle and the second as the radius.

Polar plot

Best Answer

If I understand correctly, you want all values between -40 dB and +20 dB to be plotted in the positive domain, with -40 dB being the origin of the pot. For that, you need to transform your data and then backtransform the axis labels, see Negative y value in polar plot.

For having the y axis outside the plot, you can use the approach from Gonzalo Medina's answer to Setting axis line offset?.

\documentclass[10pt,border=10pt]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\pgfplotsset{compat=1.12}    

\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
   xticklabel=$\pgfmathprintnumber{\tick}^\circ$,
   xtick={0,30,...,330},
   ytick={-40,-30,...,20},
   ymin=-40, ymax=20,
   y coord trafo/.code=\pgfmathparse{#1+40},
   rotate=-90,
   y coord inv trafo/.code=\pgfmathparse{#1-40},
   x dir=reverse,
   xticklabel style={anchor=-\tick-90},
   yticklabel style={anchor=east, xshift=-4.75cm},
   y axis line style={yshift=-4.75cm},
   ytick style={yshift=-4.75cm}
]
\addplot [no markers, thick, blue] table [col sep=comma, y=theta] {gain_xy.csv};
\addplot [no markers, thick, red] table [col sep=comma, y=phi] {gain_xy.csv};
\end{polaraxis}
\end{tikzpicture}
\end{document}
Related Question