5

folks!

I want to draw a polygon with TikZ that has a color gradient from white to gray. Unfortunately, the polygon has a small gray border and I don't know why and how to remove it. This is my MWE:

\documentclass[tikz, border=10pt]{standalone}
\begin{document}

\tikz{\path[fill, left color=white, right color=black!10] (0, 0) -- (1, 1) -- (1, 3) -- (0, 4) -- cycle;}

\end{document}

This is the result:

MWE

You can see the border which seems to be in the color black!10 (notably the left, top and bottom border). If I set the color of the border explicitly to white (draw=white) it looks fine but only on white background (of course). In my image, the left part of the polygon is on a white background the right part of a gray (black!10) background. Thus, a white border is not the solution that works for me.

So, the question is: How can I remove the border? (And: What is the reason that the border even exists?) Or, in case it is not possible: How can I set the left border to white and the right border to black!10?

Thanks for your help in advance.

Cornelius

3
  • As you accepted the answer, you can also upvote it.
    – Tarass
    Mar 17, 2018 at 13:03
  • @Tarass: I actually did this already. Due to the lack of reputation it is recorded but not publicity displayed, StackExchange said. Anyway, thanks for your suggestion.
    – Cornelius
    Mar 17, 2018 at 13:21
  • Sorry, I didn't notice that. Welcome to Latex.SX !
    – Tarass
    Mar 17, 2018 at 13:26

1 Answer 1

6

What you see is not a "real" border but rather a filled area, that is additionally shaded. Replace fill by shade to only shade it.

1
  • That's it! Easy like that! It even works if I remove fill at all.
    – Cornelius
    Mar 17, 2018 at 12:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .