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?
[Tex/LaTex] TikZ grid inside a circle
gridstikz-pgf
Related Solutions
You could use PGFplots (version 1.5) for this. It can draw polar axes with very flexible customisation possibilities:
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
width=40cm,
xmin=160,xmax=200,
ymin=2,ymax=3,
yticklabels={},
xtick={160,165,...,200},
xticklabels={160,165,...,180,-175,-170,...,-160},
minor tick num=4,
grid=both,
minor grid style=black!25,
major grid style={black!75,thick}]
\addplot coordinates {(0,1) (90,1)
(180,1) (270,1)};
\end{polaraxis}
\end{tikzpicture}
\end{document}
edit:
consider Kpym comments let expanded one "paceman" to set of them with different orientation, size, rotation and colors....
\documentclass[tikz, margin=3mm]{standalone}
\usepackage{geometry}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}%[scale=...]
\draw[thick,fill=yellow]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,0.66) circle (1.5mm);
\end{tikzpicture}\quad
\begin{tikzpicture}[xscale=-1]
\draw[thick,fill=yellow]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,2/3) circle (1.5mm);
\end{tikzpicture}\quad
\begin{tikzpicture}[scale=-1]
\draw[thick,fill=yellow]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,2/3) circle (1.5mm);
\end{tikzpicture}\quad
\begin{tikzpicture}[yscale=-1]
\draw[thick,fill=yellow]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,2/3) circle (1.5mm);
\end{tikzpicture}\quad
\begin{tikzpicture}[scale=0.75,rotate=-45]
\draw[thick,fill=yellow!50!orange]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,2/3) circle (1.5mm);
\end{tikzpicture}\quad
\begin{tikzpicture}[xscale=-0.75,yscale=0.75, rotate=45]
\draw[thick,fill=orange]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,2/3) circle (1.5mm);
\end{tikzpicture}\quad
\begin{tikzpicture}[scale=-0.75, rotate=90]
\draw[thick,fill=olive]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,2/3) circle (1.5mm);
\end{tikzpicture}
\end{document}
size and orientation of "pacman" (as you can see) you can adopt to your wishes with scaling with scale=...
, xscale=...
, yscale=...
, rotate=...
in any combination.
edit (2):
another idea is to define "paceman" as \newcommand
and use it in document also out of tikzpicture
environment:
\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\newcommand\pacman[2]{\tikz[baseline, #1]{%
\draw[thick,fill=#2]
(0,0) -- (30:1cm) arc (30:330:1cm) -- cycle;
\fill (0,2/3) circle (1.5mm);}
}
\begin{document}
\pacman{scale=1}{yellow}\quad
\pacman{xscale=-1}{yellow}\quad
\pacman{scale=-1}{yellow}\quad
\pacman{yscale=-1}{yellow}\quad
\begin{tikzpicture}
\pacman{scale=0.75,rotate=-45}{yellow!50!orange}\quad
\pacman{xscale=-0.75,yscale=0.75, rotate=45}{orange}
\end{tikzpicture}
\end{document}
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' withdraw ... grid ...