5

I'd like to smooth out a drop shadow about some specific places below my graph. I can't figure out how to do it, there's no key in the pgf-blur library that allows me to customize the the shadow further. The problematic regions of the below code have red circles around them. I'm trying to get them smoother to blend in with the rest of the graph.

I know the result is because I used the fill key to get rid of the extra shadow created by the weird shape. I don't know how to get anywhere close to this result without it.

enter image description here

\documentclass{article}

\usepackage{pgf}
\usepackage{pgfplots}

\pgfplotsset{compat=1.8}

\usepackage{tikz}
\usetikzlibrary{arrows,automata,calc,shapes, positioning,shadows,shadows.blur,shapes.geometric}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[thick,line cap=round,rounded corners, draw=red,double=white,double distance=1.6pt,fill=white, blur shadow={shadow yshift=-5pt, shadow xshift=3pt,shadow blur radius=3pt}
] table {
dof l2_err level
.2 2.6 2
%.3 2.8 3
.4 2.3 4
.5 2.4 5
.6 1.1 6
.7 1.8 7
.8 4.6 8
.9 3.3 9
1 6.2 10
};
\end{axis}
\end{tikzpicture}
\end{document}

1 Answer 1

8

Here is a solution (using a similar method as my answer to question How to add a shadow to a tikz line?):

enter image description here

\documentclass{standalone}

\usepackage{pgf}
\usepackage{pgfplots}

\pgfplotsset{compat=1.8}

\usepackage{tikz}
\usetikzlibrary{arrows,automata,calc,shapes, positioning,shadows,shadows.blur,shapes.geometric}

\tikzset{
  shadowed/.style={preaction={
      transform canvas={shift={(2pt,-1pt)}},draw opacity=.2,#1,preaction={
        transform canvas={shift={(3pt,-1.5pt)}},draw opacity=.1,#1,preaction={
          transform canvas={shift={(4pt,-2pt)}},draw opacity=.05,#1,
        }}}},
}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot[shadowed={double=gray,draw=gray},thick,line cap=round,rounded corners, draw=red,double=white,double distance=1.6pt,
] table {
dof l2_err level
.2 2.6 2
%.3 2.8 3
.4 2.3 4
.5 2.4 5
.6 1.1 6
.7 1.8 7
.8 4.6 8
.9 3.3 9
1 6.2 10
};
\end{axis}
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .