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

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




    \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))},

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

Thanks in advance.

  • 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! – Andrew Mar 24 '16 at 23:56
  • Yes, sorry. I updated the code. – totalUnimodular Mar 24 '16 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 '16 at 0:15
  • As Jens PLoz mentioned the package required updating. Thanks. – totalUnimodular Mar 25 '16 at 0:36

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

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.