I am trying to create a dotted path something like this:

\draw [dotted] (bottom) -- (top);

I would like to add fading to the path such that at the bottom its solid and at the top its 30% or 40% transparent. Other lines that intersect with my dotted line should not be transparent.

I tried this:

\draw [dotted, fading=fade north] (bottom) -- (top);

But that did not work, I have also tried this answer: Fading of horizontal lines is impossible? but I have two issues with that:

  1. The solution is not working for me, even if I start a new document and literally copy the solution over. I always see solid lines. This was an issue with my pdf viewer.

  2. I am not quite understand the concept behind that solution, what are the axis needed for and what is \addplot+ doing?

Update: While the solution in my answer below works in two cases, in two other cases I get a Latex error which says: 'Dimension too large'. All I have done was shifting the point to the right by a few centimeters.

  • You don't need any of those axis and addplot stuff. It is from pgfplots package for plotting and you don't need them – percusse Nov 7 '16 at 15:14
  • You are right, I just failed to realized that because my viewer was not showing the transparency. – lanoxx Nov 7 '16 at 15:34

The following code does render transparency (if the right viewer is used)

\coordinate (top);

\coordinate[below=10cm of top] (bottom);

\draw [red,dotted,path fading=south] (bottom) -- (top);

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.