3

I am trying to plot several polar graphs in a tikzpicture. The idea is to plot the same function but for different parameters. An idea of what I am trying to achieve can be seen below

enter image description here

Although I am able to draw all these individual functions in one single polar plot, I don't know how to draw each if them separately in a common canvas.

So, at the moment I am able to produce the following

enter image description here

using the code seen below

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}

\begin{document}
\begin{tikzpicture}
    \begin{polaraxis}
    \foreach \atwo in {0, 0.4, ..., 2.4}
        \foreach \afour in {-0.6, -0.4, ...,1.8}
            \addplot+[mark=none,domain=0:720,samples=200] 
                {1 + \atwo*(3*cos(x)^2-1)/2 - \afour*(35*cos(x)^4-30*cos(x)^2+3)/8};
    \end{polaraxis}
\end{tikzpicture}
\end{document}

The goal is therefore to draw a set of axes (a2 , a4) and in each node the corresponding polar plot without the polar axes.

Any idea on how to achieve this?

4

You could move the loops outside the polaraxis environment, and use the at parameter for the axis to move the axes around. The outer axis and ticklabels has to be done manually though. For example:

enter image description here

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}
 \foreach[count=\i] \atwo in {0, 0.4, ..., 2.4} {
    \node [below] at (\i,0) {\pgfmathprintnumber[fixed,precision=1]{\atwo}};
    \foreach [count=\j] \afour in {-0.6, -0.4, ...,1.8} {
       \ifnum\i=1
        \node [left] at (0,\j) {\pgfmathprintnumber[fixed,precision=1]{\afour}};
        \fi
        \begin{polaraxis}[
           at={(\i*1cm,\j*1cm)},
           hide axis,
           scale only axis,
           width=1cm,
           name=ax-\i-\j,
           anchor=center
          ]
            \addplot+[mark=none,domain=0:720,samples=200] 
                {1 + \atwo*(3*cos(x)^2-1)/2 - \afour*(35*cos(x)^4-30*cos(x)^2+3)/8};
       \end{polaraxis}
    }}
    \node [draw,fit=(ax-1-1)(ax-7-12)] (ax) {};
    \node [left=1.2cm] at (ax.west) {$\alpha_4$};
    \node [below=1cm] at (ax.south) {$\alpha_2$};
\end{tikzpicture}
\end{document}

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.