# PGFPlotsX and color map

#1

I want to use a different color map than “hot”. When I try to use the “viridis” color map, I get an error.
It isn’t clear to me why it should be so, since the latex code matches what I can find in the PGF manual.

@pgf ax = Axis({
view = (0, 90),
height = "11cm",
width = "14cm",
xlabel = "Frequency",
ylabel = "Angle",
grid="major",
colormap_name="hot",
enlargelimits = false
},
)


This works when color map is “hot”, but fails with

julia> include("acousticcolor.jl")! Missing number, treated as zero.
l.4562 \end{axis}
ERROR: LoadError: The latex command lualatex julia0jx0Ch.tex failed
...


\begin{axis}[view={0}{90}, height={11cm}, width={14cm}, xlabel={Frequency}, ylabel={Angle}, grid={major}, colormap name={viridis}, enlargelimits={false}]
table[row sep={\\}]
...


Any hints will be appreciated.

#2

You did not include an MWE, so the only thing I can confirm is that both versions below work fine for me:

using PGFPlotsX
x = 1:5
z = x .+ x'
@pgf Axis({"colormap/viridis"}, Plot3({surf}, Table(x, x, z)))
@pgf Axis({colormap_name = "viridis"}, Plot3({surf}, Table(x, x, z)))


producing

#3

Thanks for the example. It fails for me.

julia> include("try.jl")
! Package pgfplots Error: The colormap viridis' is undefined! Maybe you misspe
lled it?.

See the pgfplots package documentation for explanation.
Type  H <return>  for immediate help.
...

l.47 \end{axis}

Error showing value of type Axis:
ERROR: The latex command lualatex juliaef4Hf8.tex failed


Perhaps I need to update the pgfplots package?

#4

#5

Thanks for the pointer. I’m still working on the update of PGF plots, since my Ubuntu TeX Live doesn’t want to do it. Oh well.

#6

I erased texlive (sudo apt-get remove texlive), and the newly installed texlive now lives in /usr/local/texlive/2018, so that I get for which lualatex => /usr/local/texlive/2018/bin/x86_64-linux/lualatex. So I presume that’s what is found when I do build PGFPlotsX. Unfortunately the plotting with the viridis color map still fails with the same error. I tried updating: sudo /usr/local/texlive/2018/bin/x86_64-linux/tlmgr update --all claims no update is available. So if pgfplots is up-to-date, why is the color map still not found? Any ideas?

#7

A restart of the Linux machine, and the viridis colormap now displays. However, this time it is the “jet” colormap that is not found!

#8

This thing is VERY fiddly: to get the jet color map to work I have to do "colormap/jet", colormap_name="jet" does not work. On the other hand colormap_name="viridis"` works fine.

#9

I am afraid that is a pgfplots thing we can do little about.

I am surprised that Ubuntu TeXLive does not work for you, are you on 18.04?

#10

Of course, my “fiddly” comment was directed at pgfplots (no ‘X’ ;)). I will try to debug the pgfplots colormaps a bit by looking at the generated latex. When something doesn’t work for me, it is usually MODF ( my own damn fault). For what it’s worth, here is my opinion: pgfplots and PGFPlotsX are extremely impressive software, which produce astonishing graphics in camera-ready quality. Many thanks to the authors!

The texlive installation business must have to do with the fact that I am running it as a Windows Subsystem for Linux (WSL). I am currently on Ubuntu 14.04. (I know, I should upgrade, and I will at some point.)