I'm forced to define colors within my tikzset for one of my projects. This requires me to use the draw command within my tikzset to set a color.

Normally I can just use, say \draw command to just set an argument of [top color=#1,bottom color=#3, middle color=#2] to get the desired result, but in this case I want to use the draw within my tikzset to define fading colors in similar fashion.

I doubt there are any workarounds barring perhaps the shading command for which I have not found an argument equivalent (?) in the PGF manual v3.00, see page 694.


mal/.style={->, >=stealth,
single arrow, line width=16mm,
single arrow head extend=.5cm, single arrow head indent=.25cm}

And the object itself:

\begin{tikzpicture}[scale=2,node distance=1cm, auto,baseline=-.5ex]
\node (dummy) at (-5,-10) {}; 
\begin{scope}[remember picture,overlay,shift={(dummy.center)}]

\def\malpath{(8.75,4.25) arc (440:130:7.75)}
  • I just define malpath as a dummy to wrap my arrow around, if that's what you mean? – 1010011010 Apr 13 '14 at 8:53
  • my mistake. Didn't see its definition in the code – percusse Apr 13 '14 at 8:54
  • Single arrow is a node shape but you are not using it. Do you want to shade the path? If yes, that's not really trivial to do. Example, tex.stackexchange.com/questions/134283/… and another example tex.stackexchange.com/questions/5107/fading-a-path-in-tikz – percusse Apr 13 '14 at 8:56
  • Yep that's pretty much it. I'll look into the translation from that into an arc shape. – 1010011010 Apr 13 '14 at 9:00
  • I am having difficulty to understand where the top middle and bottom color should show up. The path is a arrowed curve with no node involved. But you have node specific options in the mal style. Do you want a node in the shape of a single arrow and shade it or you want that path to be colored? EDIT: Ah, OK now it's clear. – percusse Apr 13 '14 at 9:03

Well yet another polar transformation hack. We are lucky since the path is circular so we can pull off this. For other curve shapes, it's quite more involved, if not impossible

Here, the x coordinate becomes the angle so by moving up and down we control the radius. By moving left and right we play with the rotation. I placed two nodes inside and outside the transformation scope. It is pleasing enough to fool around. Notice that the arrow tip is also distorted.

    transform shape nonlinear=true,
    shape=single arrow,
    shape border rotate=180,
    top color=red,
    bottom color=blue,
    middle color=black
\def\polartransformation{% Directly from the manual

\node[arrownode,text height=1cm,middle color=white] at (0,3) {\phantom{\hspace{10cm}}};
\node[arrownode,text height=1cm] at (0,3) {\phantom{\hspace{10cm}}};
% rotate shading angle !!
\node[arrownode,shading angle=60] at (pi,-2) {\phantom{\hspace{10cm}}};
\node[arrownode,middle color=white] at (pi,-2) {\phantom{\hspace{10cm}}};

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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