1

I would like to draw and fill circular sections in a polar axis, with 0 deg in correspondence of the current vertical axis, as in the first example picture.

enter image description here

Unfortunately I couldn't find any similar example, so I'm asking here.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
    \begin{polaraxis}
    % ....
    \end{polaraxis}
\end{tikzpicture}
\end{document}
6

as pure tikz picture:

enter image description here

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

\begin{document}
\begin{tikzpicture}
% axis
\draw[->]   (-3,0.0) -- (3.5,0) node[below left] {$x$};
\draw[->]   (0,-0.5) -- (0.0,3) node[below left] {$y$};
\draw       (-5:2) arc (-5:185:2);
% ticks
\foreach \angle in {90, 60, ...,-90}
    \draw (90+\angle:1.9) -- (90+\angle:2)
                        ++ (90+\angle:0.4)
        node[fill=white, font=\footnotesize, inner sep=1pt] {$\angle$};
% sectors
    \begin{scope}[on background layer]
\fill[yellow]   (0,0) -- (135:2) arc(135:60:2) -- cycle;
\fill[orange]   (0,0) -- (105:2) arc(105:75:2) -- cycle;
    \end{scope}
\end{tikzpicture}
\end{document}
  • That's amazing, it is exactly was I was looking for! Thank you very much! – Davide Nov 14 '17 at 10:09
  • Any idea on how to invert the angle signs? I mean positive angles to the right and negative to the left. I've tried to change the code in any possible way, but the result is always the same. Thanks in advance! – Davide Nov 15 '17 at 17:33
  • this should be simple :-) : \foreach \angle in {-90, -60, ...,90} \draw (90+\angle:1.9) -- (90+\angle:2) ++ (90+\angle:0.4) node[fill=white, font=\footnotesize, inner sep=1pt] {$\angle$}; – Zarko Nov 15 '17 at 19:53
  • Thank you again for you patience! That's the first thing I had tried, but apparently this doesn't change the result! – Davide Nov 16 '17 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.