I want to plot a line, where the markers knock out a piece of the line instead of being displayed (it would be useful if there was a way to leave a bit of space around a marker, too). Drawing the marks white doesn't always work, i.e. when anything is behind the plot.
Is there a way to add the markers to the plot's clip path, so it will be transparent in the knocked-out parts instead of white?
\documentclass{minimal}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[height=3cm, width=10cm]
\addplot[fill=blue!20,draw=none,mark=none] coordinates{(0,0) (0,5) (5,5) (5,0)};
\addplot[mark=square*, mark options={scale=2, fill=white, draw=white},
samples=10] {x};
\addplot[only marks,samples=10] {x + 2*rand};
\end{axis}
\end{tikzpicture}
\end{document}
\usetikzlibrary{plotmarks}
in your MWE. – percusse Apr 13 '13 at 18:53