7

How would you draw a black line with TikZ that shades to white/transparent radially (like this) between two coordinates?

Shading is possible for rectangles (TikZ documentation, Ch. 46), though I can not define the start and end coordinate as easily as with a line.

line shading radially

Update: Another approach was to create such an shaded rectangle was posted here.

  • 1
    You might benefit from the answer http://tex.stackexchange.com/questions/91689/visualize-data-on-a-variable-radius-graph-network/93858#93858 . – Christian Feuersänger May 11 '13 at 09:22
  • 1
    This approach looks rather complicated for a seemingly easy task. Let's see what the community comes up with. – Peter Pablo May 11 '13 at 09:47
  • 1
    Do you have only straight lines or it can have corners/curves in it? This is also a seemingly easy detail but a line is a pdf object with zero width no matter what kind of path is drawn over it. So it's not that straightforward. You might consider decorations for this. – percusse May 11 '13 at 10:25
  • 1
    @percusse I want to draw lines for now but an extension for arcs would be nice (though is not absolutely necessary). Before asking I had a look at the decorations-documentation but could not find a suitable approach. – Peter Pablo May 11 '13 at 10:43
  • 1
    How "fine" should the shading be? Would e.g. 5 steps be enough? – Tom Bombadil May 11 '13 at 10:46
  • 1
  • 1
    @PaulGaborit: Yes, that's exactly what I was thinking of, but I couldn't manage to automate it. Actually, I think that this could be considered a duplicate of the question you linked. – Tom Bombadil May 11 '13 at 13:26
  • @PaulGaborit Yes, the answer linked by you goes in the right direction though, a couple of more steps would be nice to make it look smoother. The question is, if this can be automated or needs to be hardcoded. – Peter Pablo May 11 '13 at 13:41
  • @PeterPablo In my answer, there are 10 steps and the width of a step is .2pt. You can use 20 and .1pt instead... and choose a better value for draw opacity. – Paul Gaborit May 11 '13 at 17:19
  • I posted my current solution here. – Peter Pablo Mar 10 '14 at 14:00

0 Answers0