I have the following code for drawing contours
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning}
\pgfplotsset{compat=newest}
\pgfplotsset{
colormap={parula}{
rgb255=(53,42,135)
rgb255=(15,92,221)
rgb255=(18,125,216)
rgb255=(7,156,207)
rgb255=(21,177,180)
rgb255=(89,189,140)
rgb255=(165,190,107)
rgb255=(225,185,82)
rgb255=(252,206,46)
rgb255=(249,251,14)
},
}
\begin{document}
\begin{tikzpicture}[
/pgf/declare function={
func(\x, \y) = 0.5sin( deg(pi/2(2( \xcos(30) - \ysin(30) )-( \ycos(30) + \xsin(30) ))) ) + 2( \ycos(30) + \xsin(30) ) + 1;
}
]
\begin{axis}[set layers,colorbar,
view={0}{90},
xmin=-1, xmax=1,
ymin=-1, ymax=1,
xtick={-1,-0.5,0,0.5,1},
ytick={-1,-0.5,0,0.5,1},
axis on top=false,
grid=major,
]
\addplot3[domain=-1:1, y domain=-1:1, samples=51,thick,
contour gnuplot={levels={-0.891997534235677,-0.47155363773886,-0.0511097412420427,0.369334155254774,0.789778051751592,1.21022194824841,1.63066584474523,2.05110974124204,2.47155363773886,2.89199753423568},labels=false}
]
{func(x,y)};
\addplot3[domain=-1:1, y domain=-1:1, samples=51,thick,
contour gnuplot={levels={-1,3},labels=false,fill opacity=0}
]
{func(x,y)};
\end{axis}
\end{tikzpicture}
\end{document}
I've created the two contours at the output values of $z=-1$ and $z=3$ so that the colorbar would be shown to range between those values. My intention though is to have those contours be invisible by setting their opacity to 0. However, I've tried both draw opacity=0, opacity=0, and fill opacity=0, none of which have any effect on those two curves.
I've gone through the PGFPLOTS manual in hopes of there being reference to an opacity option for gnuplot contour but I have not found this
EDIT: I ultimately found a solution to my problem, solved here. However, the substance of the question still stands. How do you change the opacity of contours?
