I have a complex TikZ picture that has a width of say 10cm. I want to use the same picture at another place but want to show only the left 5cm of the picture. To have a "smoother" look, I would like to have a fading effect for the following 1cm, i.e., I want to see 0cm - 5cm normally, a linear "fade-out" of 5cm to 6cm, and nothing (= transparent or clipped) at 6cm - 10cm. Is this possible in TikZ? The standard path fading and scope fading don't seem to support such a customization.

  • Please provide minimal (non)working example, what you try to do so far. – Zarko Jul 14 '16 at 13:48
  • 1
    There should be no difference between a fading image and a fading (in the opposite direction) white overlay. – John Kormylo Jul 14 '16 at 15:22

First, I placed a 10cm wide image into a savebox. One could do the same for the original tikzpicture. Then I created two 6cm wide copies with fading edges.


\begin{minipage}{6cm}% only needed for standalone class
\clip (0,0) rectangle (6cm,\ht\mybox);
\node[above right,inner sep=0pt] at (0,0) {\usebox{\mybox}};
\fill[white,path fading=west]
  (5cm,0) rectangle (6cm,\ht\mybox);

\clip (0,0) rectangle (6cm,\ht\mybox);
\node[above left,inner sep=0pt] at (6cm,0) {\usebox{\mybox}};
\fill[white,path fading=east]
  (0,0) rectangle (1cm,\ht\mybox);
  • Only if the background is white? – cfr Jul 14 '16 at 23:15
  • @cfr - Yes, the color has to match the background. – John Kormylo Jul 15 '16 at 3:17
  • Thank you very much. I was thinking much too complicated. – user1742364 Jul 15 '16 at 8:03

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.