I'm trying to use pgfplots
to create a 2D plot with 3 variables, the third one being plotted as a color gradient.
\begin{tikzpicture}[scale=0.75]
\begin{axis}[xlabel=Selta,ylabel={Hitastig $[\si{\celsius}]$},colorbar,colormap/greenyellow]
\addplot[mesh,ultra thick]
table[x=S,y=POT_T,z=DB, col sep=semicolon]{287.csv};
\legend{Stöð 287}
\end{axis}
\end{tikzpicture}
I've been looking all over in the pgfplots manual, but I have somehow overlooked how to plot the z variable as the color gradient, this code automatically assumes the y variable is to be plotted.
It always seems problems like these are something incredibly easy that was overlooked, so I hope this will be solved in no time.
Thanks in advance :).
Edit:
Although I found the answer to this specific problem, there is another very related matter I'd like an answer to, mods correct me if this should be a separate question.
I'd like to reverse the colorbar, and have found the code to do so is to put colorbar style={z dir=reverse}
into the axis options. But as per the previous answer I can't use z as the variable name (or can I?) and pgfplots
doesn't accept colorbar style={point meta dir=reverse}
.
How would this be achieved, or how to answer the previous question in a way that lets you reverse the colorbar?