4

With the risk of sounding foolish, but I can't seem to find the answer anywhere. How can I set the ticklabels for the colorbar? Let's say I have the following code:

\documentclass{report}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
    \begin{figure}          
        \begin{tikzpicture}     
            \begin{axis}[%
                xmin=1, xmax=2,
                ymin=1, ymax=2,
                colorbar,point meta min=0.3,point meta max=5.5]
            \addplot [color=black]
            coordinates{(1,1)(2,2)};
            \end{axis}
        \end{tikzpicture}
    \end{figure}
\end{document}

You'll notice the labels for the colorbar are 1, 2, 3, 4 and 5. What if I would want for instance the random 0.3, 0.6, 1, ... , 5.5?

Cheers!

1 Answers1

2

Section 4.8.12 of the pgfplots manual explains how to configure the colorbar style. In your case, that's

colorbar style={ ytick={0.3, 0.6, 1, 5.5} }
anonymous
  • 1,159