Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I shade a path witout filling? In particular, I wand to draw a curved arrow that starts colored blue and ends colored green, where in between it gradually changes its color. I can't find a way to shade a path without filling it.

The following code does not work, as it shades the filling area, although it compiles.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,automata,patterns,decorations,decorations.pathmorphing}
\usetikzlibrary{fadings}
\begin{document}
\begin{tikzpicture}

\draw[path fading=south,very thick,top color=blue!80!white,
      bottom color=green!80!white,->] (0,0) .. controls +(0,-1) and +(0,1) .. (1,-2);

\end{tikzpicture}
\end{document}

Example image

share|improve this question
    
Do you mean that you want the path colour to change? –  Loop Space Sep 20 '13 at 15:57
1  
The fading/shading is basically a filling option. The path itself cannot be faded/shaded that easily. –  Qrrbrbirlbel Sep 20 '13 at 16:06
    
@Andrew: Yes, precisely - the color of the path (in this case, an arrow) should change. –  DCTLib Sep 20 '13 at 16:17
    
Related: Fading a path in TikZ –  Qrrbrbirlbel Sep 20 '13 at 16:23
    
Also related: How to draw an arrow with two colors? –  Qrrbrbirlbel Oct 11 '13 at 18:45

1 Answer 1

I don't remember why the scaling was happening but please let me know the missing detail or fix it so I can delete this. ( Stolen from How to draw multiple lines inside the circle )

Something along these lines can be a very impractical but a possible way to do it. I can't think of anything clever how to automate it other than the obvious tedious way.

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{fadings}%

\begin{tikzfadingfrompicture}[name=custom fade]%
\path(-0.2cm,0.2cm) rectangle (1.2cm,-2cm); % Arrow line is an overlay!
\pgfinterruptboundingbox
\draw[very thick,transparent!20,->] (0cm,0cm) .. controls +(0cm,-1cm) and +(0cm,1cm) .. (1cm,-2cm);
\endpgfinterruptboundingbox
\end{tikzfadingfrompicture}


\begin{document}

\begin{tikzpicture}
\draw[style=help lines] (0,-2) grid[step=1cm] (2,0);
\draw[path fading=custom fade,
      top color=blue!80,
      bottom color=green!80,
     ] (0,0) rectangle (1cm,-2cm);
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.