How can i make nodes along an edge fade, here is the code i used to create the nodes

\usetikzlibrary{shapes.arrows, fadings}
\draw [dashed,blue](0,0)--(7,0.5)
   node[fill,circle,inner sep=2pt,draw=black](0)[pos=0]{} 
   node[fill,circle,inner sep=1.5pt,](2)[pos=0.1]{} 
   node[fill,circle,inner sep=1.5pt,opacity=0.8](3)[pos=0.2]{} 
   node[fill,circle,inner sep=1.5pt,opacity=0.7](4)[pos=0.3]{}
   node[fill,circle,inner sep=1.5pt,opacity=0.6](5)[pos=0.4]{}
   node[fill,circle,inner sep=1.5pt,opacity=0.5](6)[pos=0.5]{}
   node[fill,circle,inner sep=1.5pt,opacity=0.4](7)[pos=0.6]{}
   node[fill,circle,inner sep=1.5pt,opacity=0.3](8)[pos=0.7]{} 
   node[fill,circle,inner sep=1.5pt,opacity=0.2](9)[pos=0.8]{}  
   node[fill,circle,inner sep=1.5pt](1)[pos=0.9]{}
   node[fill,circle,inner sep=1.5pt](10)[pos=1]{};

In this code, i tried to use opacity option for nodes, but the output edge was drawn ON the nodes as shown. I want to make it appear as if the nodes are connected with this line not the line drawn on them. code output


I think you have two options, either you mix the color with white to fake the opacity or indeed you don't connect them with a single line but draw each segment separately

\path(0,0) -- (7,0.5) \foreach \x[count=\xi from 0] in {0,0.1,...,1}{node[fill opacity={1-\x},circle,blue,pos=\x,fill] (n-\xi) {}};
\draw[blue,dashed]\foreach \x[count=\xi from 0,count=\xj from 1] in {0,0.1,...,0.9}{(n-\xi) -- (n-\xj)};

enter image description here

  • Is (n-\xi) the name of the node?, if i need to use it, can i use (n1,n2,...)? – Misaki Jul 20 '14 at 21:06
  • 1
    @misa You can use (n-1),(n-2)... – percusse Jul 20 '14 at 21:40

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.