[Tex/LaTex] TikZ grid inside a circle

gridstikz-pgf

any idea how I could draw an even grid inside a circle in TikZ? I could manually add invisible nodes on the circumferences and connect these with lines but there is probably a more sophisticated way to do this?

grid inside a circle

Best Answer

Use the TikZ macro \clip to 'cut' out everything outside of a given path, which is the circle here, later on, draw the grid as 'usual' with draw ... grid ...

\documentclass{article}

\usepackage{tikz}

\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\clip[draw] circle (5cm);
\draw (-5,-5) grid (5,5);
\end{tikzpicture}

\end{document}

enter image description here

Related Question