[Tex/LaTex] pgfplots: shadow for markers

pgfplotstikz-pgf

I was wondering if it's possible to add shadows to markers within pgfplots. I tried the circular drop shadow option (from TikZ) which unfortunately had no effect at all. I also read that one can define custom marker styles with \pgfdeclareplotmark but that's way beyond my PGF knowledge.

\documentclass{scrartcl}

\usepackage{pgfplots}
\usetikzlibrary{shadows}
\pgfplotsset{%
  mystyle/.style={red,mark=*,mark options={fill=white,circular drop shadow}}}

\begin{document}

\begin{tikzpicture}
  \begin{axis}
     \addplot[mystyle] {x^2 - x + 4};
  \end{axis}
\end{tikzpicture}

\end{document}

Am I missing the easy solution (disregarding that nothing about shadows is mentioned in the pgfplots manual) or do I have to get deeper into PGF?

Best Answer

It seems like this works:

\documentclass{scrartcl}
\usepackage{pgfplots}
\usetikzlibrary{shadows}

\pgfdeclareplotmark{*)}
{%
\fill[drop shadow={draw=black,fill=black,opacity=.25,shadow xshift=2pt,shadow
yshift=-2pt}] (0,0) circle [radius=2pt];
}

\begin{document}

\begin{tikzpicture}
  \begin{axis}
     \addplot[red,mark=*)] {x^2 - x + 4};
  \end{axis}
\end{tikzpicture}

\end{document}

It seems that it is ok to use regular tikz code inside \pgfdeclareplotmark. It may be horribly wrong, though, and could break any number of other things, so please use it with caution.