3

i have some testdata and want to create a polar plot, divided into some segments (21-24, 31-35, 41-42, ...). From the testdata i greate about 50 graphs (Var 1 ... Var x). Up to this everything works fine. Now, i try to create two parts which doesn't work:

  1. One graph with the y-min-value, one graph with the y-max-value of all of the plotted graphs at each x-tick
  2. A coloured area between the min- and max-Graph

In the example below i realized the colored area manually with coordinates. But is it possible to extraxt the plotted min- and max-values automatically? In addition, i also tried to use the funktion fill between to get the area colored between 2 graphs in a segment/domain, but this only deleted the plotted grid an didn't anything furthermore.

Here is the example and code: enter image description here

\documentclass[a4paper,11pt]{scrbook}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\usepgfplotslibrary{polar}
\usepgfplotslibrary{fillbetween}
\usepackage{pgfplotstable}

\begin{document}

\begin{tikzpicture}
\pgfplotstableread{
        XLabel  Index   Var_1   Var_2   Var_3    
        1.1     1       3       5       9          
        1.2     2       4       2       8            
        1.3     3       5       4       8            
        1.4     4       3       9       6          
        nan     5       nan     nan     nan      
        2.1     6       8       3       7            
        2.2     7       2       3       9            
        2.3     8       2       1.5     9            
        2.4     9       3       8       9            
        2.7     10      4       3       8            
        nan     11      nan     nan     nan      
        3.1     12      7       6       5            
        3.2     13      3       5       2   
}\mytable

    \begin{polaraxis}[
        width = 15cm,
        height = 15cm,
        y dir = reverse,
        rotate = 90,
        grid = both,
        major grid style = {line width=0.5pt},  
        minor grid style = {dotted},
        xtick = data,
        xticklabel style = {anchor = -\tick-90},
        xticklabels = {21,22,23,24,31,32,33,34,35,41,42},
        ytick = {2,...,10},
        yticklabels = {2,3,4,5,6,7,8,9,10},
        minor y tick num = {1},
        yticklabel style = {anchor = east},
        ymin = 1, ymax = 10,
        unbounded coords = jump,
    ]

    \addplot+[name path = Var1, very thick, mark=none] table [x expr = {\thisrow{Index}*(360/31)}, y = Var_1] {\mytable};
    \addplot+[name path = Var2, very thick, mark=none] table [x expr = {\thisrow{Index}*(360/31)}, y = Var_2] {\mytable};
    \addplot+[name path = Var3, very thick, mark=none] table [x expr = {\thisrow{Index}*(360/31)}, y = Var_3] {\mytable};
    \addplot [black, very thick, fill=green, draw=none, fill opacity=0.25] coordinates {
    (360/31*1,3)(360/31*1,9)(360/31*2,8)(360/31*3,8)(360/31*4,9)
    (360/31*4,3)(360/31*3,4)(360/31*2,2)(360/31*1,3)};

    \legend{Var 1,Var 2,Var 3};

        \end{polaraxis}
\end{tikzpicture}

\end{document}

Thanks a lot for your help, as i invested days and didn't get it solved on my own.

  • 1
    Welcome to TeX.SX. I think because the fillbetween library is relatively new, the combination with the polar library just isn't implemented so far. But in case this should be a bug, I have reported it here. – Stefan Pinnow Apr 16 '16 at 19:13
  • Hello Stefan, thanks for the confirmation that my second question seems to be a bug. Can you help me with the other question "One graph with the y-min-value, one graph with the y-max-value of all of the plotted graphs at each x-tick", too? – Stefan Apr 17 '16 at 16:27

Your Answer

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

Browse other questions tagged or ask your own question.