# Stripey balls in tikz

I would like to insert a stripey ball in TikZ, i.e. a filled-in circle that looks like this one. Would you know a clever solution for doing that?

-
Welcome to TeX.SX! I added your image for you. When you get a bit more reputation you will be able to add them yourself. –  Alan Munn Mar 18 '11 at 1:25
Thank you, Alan! –  Thanos D. Papaïoannou Mar 18 '11 at 1:44

## 1 Answer

You can declare a pattern and then apply it to the circle. This is quite easy to do, but you need to know the PGF commands for generating graphics. See section 78 ”Patterns” in the manual (v2.10).

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}

\pgfdeclarepatternformonly{stripes}
{\pgfpointorigin}{\pgfpoint{1cm}{1cm}}
{\pgfpoint{1cm}{1cm}}
{
\pgfpathmoveto{\pgfpoint{0cm}{0cm}}
\pgfpathlineto{\pgfpoint{1cm}{1cm}}
\pgfpathlineto{\pgfpoint{1cm}{0.5cm}}
\pgfpathlineto{\pgfpoint{0.5cm}{0cm}}
\pgfpathclose%
\pgfusepath{fill}
\pgfpathmoveto{\pgfpoint{0cm}{0.5cm}}
\pgfpathlineto{\pgfpoint{0cm}{1cm}}
\pgfpathlineto{\pgfpoint{0.5cm}{1cm}}
\pgfpathclose%
\pgfusepath{fill}
}

\begin{tikzpicture}
\filldraw[pattern=stripes, pattern color=black!60]
(0,0) circle[radius=1cm];
\end{tikzpicture}
\end{document}


Every tile in the pattern looks like .

The unfortunate disadvantage of patterns is that they are not always rendered correctly. For example, there might be small white stripes where the boxes of the patters border. The picture above was taken with Adobe Acrobat at 125% zoom level. Evince renders it the following way (it seems to rasterize the pattern, hence the fuzziness):

-
Brilliant, dear Caramdir, thanks! This works without a hitch on my machine when I change “(0,0) circle[radius=1cm];” to “(0,0) circle (1cm);”. –  Thanos D. Papaïoannou Mar 18 '11 at 13:43
@Thanos: the [radius=...] notation seems to be the preferred way to draw circles in version 2.10 of TikZ (but might not be available in older versions). –  Caramdir Apr 3 '11 at 2:39
Funny, those small stripes vanish (in evince) when I do the same with 0.5cm wide stripes. I guess you can fix those gaps by simply drawing one of the pieces a tad bigger. –  Raphael Jun 21 '12 at 14:02