-
-
Save Curtis-64/1671387d99449119acd9c28405d985fa to your computer and use it in GitHub Desktop.
tikz graphics rendering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Tikz graphics rendering discovery example by Curtis White | |
Draw a large circle and two smaller circles inside it. Tikz | |
\begin{tikzpicture} | |
\draw (0,0) circle (2cm); | |
\draw (0,0) circle (1cm); | |
\draw (0,0) circle (0.5cm); | |
\end{tikzpicture} | |
'Copy/paste into a LATEXT editor with support for TKZ package. I used overleaf. | |
\documentclass{standalone} | |
\usepackage{tikz} | |
\begin{document} | |
\begin{tikzpicture} | |
\draw (0,0) circle (2cm); | |
\draw (0,0) circle (1cm); | |
\draw (0,0) circle (0.5cm); | |
\end{tikzpicture} | |
\end{document} | |
`Long play example | |
Draw a square in the center of the page. tikz | |
\begin{tikzpicture}[thick,scale=1] | |
\draw(0,0) rectangle (4,4); | |
\end{tikzpicture} | |
Add whitespace around it-- so it appears smaller. | |
\begin{tikzpicture}[thick,scale=1] | |
\draw(1,1) rectangle (3,3); | |
\end{tikzpicture} | |
Make the background bigger or shrink the square. | |
\begin{tikzpicture}[thick,scale=1] | |
\draw(-1,-1) rectangle (5,5); | |
\draw(1,1) rectangle (3,3); | |
\end{tikzpicture} | |
Now, draw a circle sitting on top of it so that the circle appears to "sit" on the top of the box. Not over it. | |
\begin{tikzpicture}[thick,scale=1] | |
\draw(-1,-1) rectangle (5,5); | |
\draw(1,1) rectangle (3,3); | |
\draw (2,3.5) circle (0.5); | |
\end{tikzpicture} | |
Make the circle red and filled. Fill the box with blue. Background white. | |
\begin{tikzpicture}[thick,scale=1] | |
\filldraw[fill=blue] (-1,-1) rectangle (5,5); | |
\filldraw[fill=white] (1,1) rectangle (3,3); | |
\filldraw[fill=red] (2,3.5) circle (0.5); | |
\end{tikzpicture} | |
Reverse the white and blue. | |
\begin{tikzpicture}[thick,scale=1] | |
\filldraw[fill=white] (-1,-1) rectangle (5,5); | |
\filldraw[fill=blue] (1,1) rectangle (3,3); | |
\filldraw[fill=red] (2,3.5) circle (0.5); | |
\end{tikzpicture} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment