Skip to content

Instantly share code, notes, and snippets.

@antoineMoPa
Created December 15, 2015 22:56
Show Gist options
  • Save antoineMoPa/9afb4860cd2fd3e44e3c to your computer and use it in GitHub Desktop.
Save antoineMoPa/9afb4860cd2fd3e44e3c to your computer and use it in GitHub Desktop.
Basics of tikz (lines, plots, grids)
\section{Example drawings with tikz}
% cremeronline.com/LaTeX/minimaltikz.pdf
% You have to \usepackage{tikz}
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (2,4);
\draw (0,1) --(1,3.666) --(2,1) -- (2,0) --(0,0) -- (0,1);
\draw [->] (3.5,0.5) -- (6,0.5);
\draw [|->] (3.5,1) -- (6,1);
\draw [|->] [ultra thin] (3.5,1.5) -- (6,1.5);
\draw [|->] [very thin] (3.5,2) -- (6,2);
\draw [|->] [thin] (3.5,2.5) -- (6,2.5);
\draw [|->] [semithick] [green] (3.5,3) -- (6,3);
\draw [|->] [thick] [dashed] (3.5,3.5) -- (6,3.5);
\draw [|->] [very thick] (3.5,4) -- (6,4);
\draw [|->] [ultra thick] (3.5,4.5) -- (6,4.5);
\draw [<->] (0,5) -- (0,5.5) -- (0.5,5) -- (0.5,5.5);
\end{tikzpicture}
\caption{Lines and grids}
\end{center}
\end{figure}
\begin{figure}[!h]
\begin{center}
\begin{tikzpicture}
\draw [->] (0,0) -- (0,1);
\draw [->] (0,0) -- (2*pi,0);
\draw [red,domain=0:2*pi] plot (\x,{sin(\x r});
\draw [olive,domain=0:2*pi] plot (\x,{0.5*sin(\x r});
\draw [domain=0:2*pi] plot (\x,{0.25*sin(\x r});
\end{tikzpicture}
\caption{Plot}
\end{center}
\end{figure}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment