Skip to content

Instantly share code, notes, and snippets.

@b-mehta
Created April 18, 2018 16:02
Show Gist options
  • Save b-mehta/f1295f14035448ba9e2258e44f97eefa to your computer and use it in GitHub Desktop.
Save b-mehta/f1295f14035448ba9e2258e44f97eefa to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage{tikz}
\usepackage[landscape]{geometry}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=2]
\begin{scope}[every path/.append style={gray, ultra thin}]
\fill [orange!10] (2, 1) rectangle (6, 2);
\fill [orange!10] (3, 2) rectangle (6, 3);
\begin{scope}[xshift=4cm, yshift=3cm, scale=1/2]
\fill [orange!20] (1, 0) rectangle (2, 1);
\begin{scope}[every path/.append style={fill=orange!28, line width=0.06pt}, scale=1/2]
\foreach \y/\b/\e in {0/0/1,0/1/2,1/1/2}
\fill (\b,\y) rectangle (\e,\y+1);
\begin{scope}[every path/.append style={fill=orange!35}, scale=1/2]
\fill (0, 2) rectangle (2, 3);
\fill (4, 4) rectangle (8, 5);
\fill (7, 5) rectangle (8, 6);
\begin{scope}[every path/.append style={fill=orange!43, line width=0.03pt}, scale=1/2]
\foreach \y/\b/\e in {6/1/4,7/3/4,8/5/8,10/10/14,11/13/14}
\fill (\b,\y) rectangle (\e,\y+1);
\begin{scope}[every path/.append style={fill=orange!50}, scale=1/2]
\foreach \y/\b/\e in {12/0/2,13/1/2,14/4/6,16/8/10,18/13/16,19/15/16,20/18/20,22/23/26,24/29/32}
\fill (\b,\y) rectangle (\e,\y+1);
\foreach \y/\b/\e in {13/0/1, 14/0/4, 15/3/6, 16/5/8, 17/7/10, 18/9/13, 19/12/15,
20/14/18, 21/17/20, 22/19/23, 23/22/26, 24/25/29, 25/28/32, 26/31/32}
\draw [step=0.5] (\b,\y) grid (\e,\y+1);
\end{scope}
\foreach \x/\y/\z in {6/0/1, 7/0/3, 8/2/5, 9/4/8, 10/7/10, 11/9/13, 12/12/16, 13/15/16}
\draw [step=0.5] (\y,\x) grid (\z,\x+1);
\end{scope}
\foreach \x/\y/\z in {3/0/2, 4/1/4, 5/3/7, 6/6/8}
\draw [step=0.5] (\y,\x) grid (\z,\x+1);
\end{scope}
\draw [step=0.5] (0,1) grid (1,2);
\draw [step=0.5] (0,2) grid (4,3);
\draw [step=0.5] (3,3) grid (4,4);
\end{scope}
\draw [step=1] (0, 0) grid (2, 2);
\draw [step=0.5] (0, 0) grid (1, 1);
\draw [step=0.5] (0, 1) grid (1, 2);
\draw [step=0.5] (1, 1) grid (2, 2);
\begin{scope}[every path/.append style={line width=0.02pt}, scale=1/32]
\foreach \y/\b/\e in {27/0/2,28/1/4,29/3/7,30/6/9,31/8/11,32/10/13,33/12/16,34/15/18,
35/17/20,36/19/23,37/22/25,38/24/27,39/26/30,40/29/32,41/31/35,
42/34/37,43/36/40,44/39/43,45/42/45,46/44/48,47/47/51,48/50/54,
49/53/57,50/56/60,51/59/63,52/62/64}
\draw [step=0.5] (\b,\y) grid (\e,\y+1);
\end{scope}
\begin{pgfonlayer}{background}
\begin{scope}[every path/.append style={fill=orange!58}, scale=1/32]
\foreach \y/\b/\e in {26/0/2,28/4/8,29/7/8,30/9/12,31/11/12,32/13/16,34/18/20,36/23/26,
37/25/26,38/27/30,40/32/36,41/35/36,42/37/40,44/43/46,45/45/46,
46/48/52,47/51/52,48/54/58,49/57/58,50/60/64,51/63/64}
\fill (\b,\y) rectangle (\e,\y+1);
\end{scope}
\begin{scope}[every path/.append style={fill=orange!65}, scale=1/64,yshift=1pt,xshift=1pt]
\foreach \y/\b/\e in {54/1/4,56/6/8,58/10/14,59/13/14,60/15/18,61/17/18,62/19/22,
64/24/26,66/29/32,67/31/32,68/33/36,70/38/40,72/43/46,73/45/46,
74/47/50,76/52/54,78/57/60,79/59/60,80/62/64,82/67/70,83/69/70,
84/72/74,86/77/80,87/79/80,88/82/86,89/85/86,90/87/90,92/93/96,
93/95/96,94/98/102,95/101/102,96/104/108,97/107/108,98/110/114,
99/113/114,100/116/120,101/119/120,102/122/126,103/125/126}
\fill (\b,\y) rectangle (\e,\y+1);
\end{scope}
\end{pgfonlayer}
\end{scope}
\node (A) at (1.0, 2.0) {};
\node (B) at (2.0, 1.0) {};
\node (C) at (6.0, 0.7) {};
\node (D) at (6.0, 3.8) {};
\node (E) at (3.0, 3.0) {};
\draw [cyan!50!blue] plot [smooth cycle, tension=0.7] coordinates {(A) (B) (C) (D) (E)};
\end{scope}
\draw [gray, very thin, step=1] (-0.7,-0.7) grid (7.7,4.7);
\draw [->] (-0.8, 0) -- (7.9, 0);
\draw [->] (0, -0.8) -- (0, 4.9);
\end{tikzpicture}
\end{center}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment