I am trying to create a contour plot with labels in the contour lines. The data is imported from Octave, and stored in a file called data.dat. It contains many contour lines, so that manual modification of the file is not practical.
The following code reproduces the problem:
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[contour prepared]
table {
0 2.875 5
3 2.875 5
0 2.825 4
3 2.825 4
0 2.75 3
3 2.75 3
0 2.5 2
3 2.5 2
0 1 1
3 1 1
};
\end{axis}
\end{tikzpicture}
\end{document}
The result has some contour lines too close to each other and therefore their labels overimpose. I would like to automatically limit the number of labels that are added to the contour lines in two ways:
- Those labels with greater value than certain number will not appear. In my example, for example, show only labels in contour lines with value lower than 3.
- Show labels only for selected contour lines. For example, remove the label that equals to 4.
Any hints about what options to play with are welcome, as I could not find a proper way to do this in the documentation.
