1

I am trying to plot a filled a contour. I used surf for this.

Here is my MWE:

\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepgfplotslibrary{colormaps} 
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{mathtools}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
    colormap/jet,
    colorbar,
    view={0}{90},
    x=14 cm,
    y=7 cm,
    z=0 cm,xlabel=$z$, ylabel=$r$]
    \addplot3[surf,shader=interp] file {Vz1.dat};
\end{axis}
\end{tikzpicture}
\end{document}

However, this produced a coarse filled contour: enter image description here

The corresponding data file is here.

In order to get smooth filled contours, I followed this question's second answer

\documentclass{standalone}

\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer,patchplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}

\begin{axis}[
    colormap/jet,
    colorbar,
    view={0}{90},
    x=14 cm,
    y=7 cm,
    z=0 cm,xlabel=$z$, ylabel=$r$]

    \addplot3[
        contour filled={number = 30,labels={false}}, 
            thick] table {Vz1.dat};

\end{axis}  
\end{tikzpicture}
\end{document}

However, this throws me the following error

! Package pgfkeys Error: I do not know the key '/tikz/contour filled', to whichyou passed 'number = 30,labels={false}', and I am going to ignore it.

How do I resolve this or get a smooth filled contour?

  • Both examples work perfectly fine for me. Which version of PGFPlots do you have? The most recent one is PGFPlots v1.14, so maybe an update solves the problem. – Stefan Pinnow Feb 07 '17 at 11:44
  • @StefanPinnow I upgraded my texlive and the log file shows (TeX Live 2016/Debian). But still contour filled throws the same error – Rhinocerotidae Feb 07 '17 at 12:53
  • @StefanPinnow: I just found out that my pgfplot version is 1.13. How do I upgrade it? – Rhinocerotidae Feb 07 '17 at 13:02
  • 4
    I'm voting to close this question as off-topic because, because the issue raised could be resolved by a package update. – AlexG Feb 07 '17 at 13:41

1 Answers1

2

Old pgfplot version is the culprit.(as Mr. Pinnow pointed out)

I solved it using

sudo tlmgr install pgfplots