# Displaying a portion of tikz picture

Using the answer here, I was able to draw a hexagonal grid. I would like to display only a circular region (centered at the origin) of this lattice, similarly to what was done in this question, but without the whole hexagon showing in the background. How would I do that?

Thanks!

\documentclass[11pt]{scrartcl}
\usepackage{fullpage}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{center}
\begin{tikzpicture}[x=1.5cm,y=1.5cm]
\newcommand*\rows{6}
\foreach \row in {0, ...,\rows}
{
\draw[blue!60]
% hexagonal grid drawn in three steps corresponding to 3*2 opposite regions
% diagonal
($\row*(0.5, {0.5*sqrt(3)})$) -- ($(\rows,0)+\row*(-0.5, {0.5*sqrt(3)})$)
($\row*(1, 0)$) -- ($(\rows/2,{\rows/2*sqrt(3)})+\row*(0.5,{-0.5*sqrt(3)})$)
($\row*(1, 0)$) -- ($(0,0)+\row*(0.5,{0.5*sqrt(3)})$)
($(0,0)-\row*(0.5, {0.5*sqrt(3)})$) -- ($(0,0)-(\rows,0)-\row*(-0.5,{0.5*sqrt(3)})$)
($(0,0)-\row*(1, 0)$) -- ($(0,0)-(\rows/2,{\rows/2*sqrt(3)})-\row*(0.5,{-0.5*sqrt(3)})$)
($(0,0)-\row*(1, 0)$) -- ($(0,0)-\row*(0.5,{0.5*sqrt(3)})$)
% antidiagonal
($\row*(-0.5, {0.5*sqrt(3)})$) -- ($(-\rows,0)+\row*(+0.5, {0.5*sqrt(3)})$)
($\row*(-1, 0)$) -- ($(-\rows/2,{\rows/2*sqrt(3)})+\row*(-0.5,{-0.5*sqrt(3)})$)
($\row*(-1, 0)$) -- ($(0,0)+\row*(-0.5,{0.5*sqrt(3)})$)
($(0,0)-\row*(-0.5, {0.5*sqrt(3)})$) -- ($(0,0)-(-\rows,0)-\row*(+0.5, {0.5*sqrt(3)})$)
($(0,0)-\row*(-1, 0)$) -- ($(0,0)-(-\rows/2,{\rows/2*sqrt(3)})-\row*(-0.5,{-0.5*sqrt(3)})$)
($(0,0)-\row*(-1, 0)$) -- ($(0,0)-\row*(-0.5,{0.5*sqrt(3)})$)
% vertical strip
($\row*(-0.5, {0.5*sqrt(3)})$) -- ($\row*(0.5, {0.5*sqrt(3)})$)
($\rows*(-0.5, {0.5*sqrt(3)})+\row*(1,0)$) -- ($\row*(0.5, {0.5*sqrt(3)})$)
($\row*(-0.5, {0.5*sqrt(3)})$) -- ($\rows*(0.5, {0.5*sqrt(3)})+\row*(-1,0)$)
($(0,0)-\row*(-0.5, {0.5*sqrt(3)})$) -- ($(0,0)-\row*(0.5, {0.5*sqrt(3)})$)
($(0,0)-\rows*(-0.5, {0.5*sqrt(3)})-\row*(1,0)$) -- ($(0,0)-\row*(0.5, {0.5*sqrt(3)})$)
($(0,0)-\row*(-0.5, {0.5*sqrt(3)})$) -- ($(0,0)-\rows*(0.5, {0.5*sqrt(3)})-\row*(-1,0)$);
}
\end{tikzpicture}
\end{center}
\end{document}
• A possibility would be to save the exagon in a standalone pdf and then include the part you are interested with includegraphics with the appropriate scale,crop etc. options. But I'm not sure this is what you want. – Nico Boni Oct 7 '14 at 17:27

You can add a \clip before the drawing. Below i added \clip (0,0) circle (4.75cm); so that we only see the grid within specified circle:

## Code:

\documentclass[11pt]{scrartcl}
\usepackage{fullpage}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{center}
\begin{tikzpicture}[x=1.5cm,y=1.5cm]
\newcommand*\rows{6}
\clip  (0,0) circle (4.75cm);
\foreach \row in {0, ...,\rows} {
\draw[blue!60, ultra thick]
% hexagonal grid drawn in three steps corresponding to 3*2 opposite regions
% diagonal
($\row*(0.5, {0.5*sqrt(3)})$) -- ($(\rows,0)+\row*(-0.5, {0.5*sqrt(3)})$)
($\row*(1, 0)$) -- ($(\rows/2,{\rows/2*sqrt(3)})+\row*(0.5,{-0.5*sqrt(3)})$)
($\row*(1, 0)$) -- ($(0,0)+\row*(0.5,{0.5*sqrt(3)})$)
($(0,0)-\row*(0.5, {0.5*sqrt(3)})$) -- ($(0,0)-(\rows,0)-\row*(-0.5,{0.5*sqrt(3)})$)
($(0,0)-\row*(1, 0)$) -- ($(0,0)-(\rows/2,{\rows/2*sqrt(3)})-\row*(0.5,{-0.5*sqrt(3)})$)
($(0,0)-\row*(1, 0)$) -- ($(0,0)-\row*(0.5,{0.5*sqrt(3)})$)
% antidiagonal
($\row*(-0.5, {0.5*sqrt(3)})$) -- ($(-\rows,0)+\row*(+0.5, {0.5*sqrt(3)})$)
($\row*(-1, 0)$) -- ($(-\rows/2,{\rows/2*sqrt(3)})+\row*(-0.5,{-0.5*sqrt(3)})$)
($\row*(-1, 0)$) -- ($(0,0)+\row*(-0.5,{0.5*sqrt(3)})$)
($(0,0)-\row*(-0.5, {0.5*sqrt(3)})$) -- ($(0,0)-(-\rows,0)-\row*(+0.5, {0.5*sqrt(3)})$)
($(0,0)-\row*(-1, 0)$) -- ($(0,0)-(-\rows/2,{\rows/2*sqrt(3)})-\row*(-0.5,{-0.5*sqrt(3)})$)
($(0,0)-\row*(-1, 0)$) -- ($(0,0)-\row*(-0.5,{0.5*sqrt(3)})$)
% vertical strip
($\row*(-0.5, {0.5*sqrt(3)})$) -- ($\row*(0.5, {0.5*sqrt(3)})$)
($\rows*(-0.5, {0.5*sqrt(3)})+\row*(1,0)$) -- ($\row*(0.5, {0.5*sqrt(3)})$)
($\row*(-0.5, {0.5*sqrt(3)})$) -- ($\rows*(0.5, {0.5*sqrt(3)})+\row*(-1,0)$)
($(0,0)-\row*(-0.5, {0.5*sqrt(3)})$) -- ($(0,0)-\row*(0.5, {0.5*sqrt(3)})$)
($(0,0)-\rows*(-0.5, {0.5*sqrt(3)})-\row*(1,0)$) -- ($(0,0)-\row*(0.5, {0.5*sqrt(3)})$)
($(0,0)-\row*(-0.5, {0.5*sqrt(3)})$) -- ($(0,0)-\rows*(0.5, {0.5*sqrt(3)})-\row*(-1,0)$);
}
\end{tikzpicture}
\end{center}
\end{document}
• Great! Thanks, that's exactly what I needed! – Olivier Bégassat Oct 7 '14 at 17:45