4

I am trying to create a PGFPlots surf using the colormap viridis in a similar fashion as some examples of the PGFPlots package manual. I will get the error

Package pgfkeys Error: I do not know the key '/tikz/colormap/viridis' and I am going to ignore it. Perhaps you misspelled it. \end{axis}

when using the code

\documentclass{article}
\pagestyle{empty}                       % don't show the page number

\usepackage{graphicx}
\usepackage{algorithmic}
\usepackage{rotating}


\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps} 
\usetikzlibrary{pgfplots.colormaps} 
\usetikzlibrary[pgfplots.colormaps] 

\begin{document}

\begin{center} 
\begin{tikzpicture}
    \begin{axis}[colormap/viridis , hide axis]
        \addplot3[surf,z buffer=sort,samples=20,domain=-1:0,y domain=0:2*pi]
        ({-2*x * cos(deg(y))},
        {-2*x* sin(deg(y))},
        -x^2+100);
    \end{axis}
\end{tikzpicture}
\end{center} 
\end{document}

I also tried colormap name=viridis, but still no cigar. Any ideas

Thanks in advance.

4
  • Welcome to TeX.SX!! I suspect that you just need to load a pgf library. It is better to post a full minimal working example that starts with a \documentclass command, has a minimal preamble and then \begin{document}...\end{document}. In particular, here it would be helpful to know exactly what packages you are using. This makes it much easier for people to help you --- and much more likely that they will!
    – user30471
    Mar 24, 2016 at 23:56
  • Yes, sorry. I updated the code. Mar 24, 2016 at 23:59
  • Looks like this colormap is an addon to the latest version of pgfplots. Are your Latex packages up to date?
    – JMP
    Mar 25, 2016 at 0:15
  • As Jens PLoz mentioned the package required updating. Thanks. Mar 25, 2016 at 0:36

1 Answer 1

4

The colormap 'viridis' is an addon to the latest version of pgfplots. After updating my Latex packages it worked for me.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .