1

I am trying to insert this filled contour plot made in matplotlib into a beamer document:

enter image description here

I use matplotlib2tikz to create the following PGFPlots file:

% This file was created by matplotlib2tikz v0.5.12.
\begin{tikzpicture}

\definecolor{color20}{rgb}{0.848040402364706,0.338280037976471,0.275205639458824}
\definecolor{color21}{rgb}{0.795937539486275,0.241845285341176,0.220829749133333}
\definecolor{color22}{rgb}{0.735076625294118,0.104459631058824,0.171492301254902}
\definecolor{color15}{rgb}{0.968862500364706,0.710838483811765,0.599900504431373}
\definecolor{color14}{rgb}{0.960581198423529,0.76250101852549,0.667963547101961}
\definecolor{color17}{rgb}{0.953053600247059,0.585210867298039,0.465372634627451}
\definecolor{color16}{rgb}{0.966922105,0.651968645152941,0.531997115623529}
\definecolor{color11}{rgb}{0.867427635086275,0.864376599772549,0.862602462019608}
\definecolor{color10}{rgb}{0.818056493411765,0.855589677545098,0.91463761654902}
\definecolor{color13}{rgb}{0.940878943,0.805596402823529,0.735166556470588}
\definecolor{color12}{rgb}{0.909459597752941,0.839386479764706,0.800331352423529}
\definecolor{color19}{rgb}{0.892137542788235,0.425388737098039,0.333289272760784}
\definecolor{color18}{rgb}{0.929357138294118,0.512253534745098,0.400672743156863}
\definecolor{color1}{rgb}{0.304174287003922,0.406944882839216,0.845262726698039}
\definecolor{color0}{rgb}{0.252662597254902,0.332836787647059,0.783665025941176}
\definecolor{color3}{rgb}{0.414800902854902,0.546873527027451,0.939087532337255}
\definecolor{color2}{rgb}{0.358414977364706,0.478426170070588,0.896794645576471}
\definecolor{color5}{rgb}{0.538004215701961,0.674901593647059,0.991721893552941}
\definecolor{color4}{rgb}{0.478462251294118,0.616563643607843,0.972720895431373}
\definecolor{color7}{rgb}{0.65668286754902,0.771806476764706,0.994913837752941}
\definecolor{color6}{rgb}{0.597776775494118,0.727329724882353,0.999776731776471}
\definecolor{color9}{rgb}{0.768034364352941,0.837035219529412,0.952488218235294}
\definecolor{color8}{rgb}{0.71385249134902,0.808857141337255,0.979386485219608}

\begin{groupplot}[group style={group size=2 by 1}]
\nextgroupplot[
xlabel={Digamma (Fraction electric)},
ylabel={L/D},
xmin=0, xmax=1,
ymin=10, ymax=20,
axis on top,
width=\textwidth,
height=0.7\textwidth
]
\addplot [fill=color0, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color1, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color2, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color3, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color4, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color5, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color6, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color7, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color8, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color9, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color10, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color11, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color12, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color13, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color14, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color15, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color16, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color17, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color18, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color19, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color20, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color21, mark=*, only marks] table {%
0.0 0.0
};
\addplot [fill=color22, mark=*, only marks] table {%
0.0 0.0
};
\end{tikzpicture}

When I run the following MWE:

\documentclass[11pt]{beamer}

\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}

\usetheme{default}
\begin{document}
    \begin{frame}
        \frametitle{test}

        \begin{figure}
            \input{low_EWF_cont.pgf}
        \end{figure}

    \end{frame}
\end{document}

I get the error:

Extra }, or forgotten \endgroup. \end{tikzpicture}

I think this might be due to a bug in matplotlib2tikz because there is a \end{groupplot} missing just before the \end{tikzpicture} on the final line. However, when I insert \end{tikzpicture}, the document compiles but only the axes and labels of the plot is generated, without any filled contours or colour bar, such as in this picture:

enter image description here

Any advice?

  • The version of matlab2tikz makes no use of the (relatively young) feature contour filled. You may want to look for a more recent version of matlab2tikz and/or report the problem for matlab2tikz. Depending on the format of your input data in matlab, it is relatively simple to produce such a graphics directly in pgfplots using contour filled. – Christian Feuersänger Oct 21 '16 at 17:28
  • @ChristianFeuersänger, I am using matplotlib2tikz, not matlab2tikz, but I think it is the same developers so I guess your comments are still. valid. Thank you. – Jonny Oct 21 '16 at 17:39
  • 1
    Sorry for reading without the proper care! I must have jumped to conclusions. The remark regarding builtin functionality of pgfplots is still valid, though. – Christian Feuersänger Oct 21 '16 at 21:02
  • @Jonny Did you manage to find a solution to your problem? I am facing the same issue. I have found out the missing part in the output of matplotlib2tikz, however I don't know how to implement it in its source code to correct it. – Soni Oct 24 '17 at 20:01

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.