The issue: making a background gradient with tikz I had the following problem. The resolution of gradient is very low and hatched lines appear. (see an MWE + picture below)

The question: Is it possible to increase the resolution so that the gradient be smooth?


\definecolor{mydb} {RGB}{68,48,0}


\begin{tikzpicture}[remember picture,overlay]
\node [shading = axis,rectangle, left color=mydb, right color=mydb!30!white,shading angle=135, anchor=north, minimum width=45.5cm, minimum height=25.5cm, samples=2000] (box) at (10,25){};
\node[minimum height=210mm,minimum width=148.5mm,outer sep=0pt] (a)



  • 1
    Are you using latexdvipsps2pdf by any chance? If so, I think you are out of luck because of how the shadings are constructed in Level 2 PostScript. If you are using pdflatex, then I think this is a viewer issue. It looks bad for me in some viewers (notably acroread 9), but good in zathura (poppler based viewer). Aug 29, 2019 at 13:28
  • @David Purton Using either latex → dvips → ps2pdf, either pdflatex I'm getting, more or less, the same result. I think that the interesting issue is the possibility of changing the resolution from tikz itself. I'm not sure whether this is possible or not. Aug 29, 2019 at 13:58
  • 2
    You could change it for the dvips driver by rewriting the PostScript. But believe me, you don't want to do this unless you are crazy :). The pdftex driver uses a built in PDF function for the gradient. tikz does not have control over how it renders. Rather viewers decide how they will render the shading, so you get different output from different viewers. Banding effects are also increased when your two colours are very similar as there aren't as many colours to go in between. Aug 29, 2019 at 14:07
  • 1
    Your other option is to render the gradient yourself to a bitmap using ghostscript and include the bitmap. This also gives a smooth gradient for me. Aug 29, 2019 at 14:10
  • 1
    BTW, the samples=2000 has no effect on your shading. Aug 29, 2019 at 14:33

1 Answer 1


I use Asymptote adapted with gkov's code, and find that axialshade seems to be better than TikZ's shade.

enter image description here

pen pena=RGB(68,48,0), penb=.3pena+.7white;
pair a=plain.SW, b=plain.NE;
axialshade(box((-2,-2),(2,2)), pena, 2a, penb, 2b);

// compiling F5 on texstudio on Windows 10
// Build "C:\Program Files (x86)\Asymptote/asy.exe" -f pdf -noView %.asy
// ImageMagick: magick -density 960 x.pdf x.png
  • 2
    This doesn't give better banding than tikz when I view it in acroread, which confirms my suspicion that this problem is basically a viewer issue. Aug 30, 2019 at 6:40
  • Nevertheless, It would be very functional to have something analog to the option samples that we have for tikz-lines! Aug 30, 2019 at 15:12
  • 1
    @GrigoriosKostakos, actually it wouldn't help much. With 8bit colour channels there isn't 2000 shades between your two colours anyway. Sep 1, 2019 at 6:42

You must log in to answer this question.

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