\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{scalefnt}

\usepackage{listings}
\lstset{
	language=tex,%
	%basicstyle=\texttt
}

\usepackage{tikz,pgfplots}
\usepackage{pgfplotstable}
\usepgfplotslibrary{dateplot}

\usetikzlibrary{shapes.symbols,shapes.geometric}
\usetikzlibrary{positioning}

%\hypersetup{pdfpagemode=FullScreen}

%\newcommand{\TikZ}{Ti{\emph{k}}Z}
\def\TikZ{Ti{\em k}Z}

\title{\TikZ{} \& PGF(Plots)}
\author{Daniel Knittl-Frank}
\institute{Linux User Group, Campus Hagenberg}
\date{December 2016}
\titlegraphic{
	\includegraphics[height=2cm]{fhlug}
}
%\subject{\latex}

\pgfplotsset{
	discard if/.style 2 args={
		x filter/.code={
			%\ifdim\thisrow{#1} pt=#2pt
			\ifdim\thisrow{#1} pt=#2 pt
			\def\pgfmathresult{nan}
			\fi
		}
	},
	discard higher/.style 2 args={
		x filter/.code={
			\ifdim\thisrow{#1} pt<\prevrow{#1} pt
				\def\pgfmathresult{nan}
			\fi
		}
	}
}
\pgfplotstableset{col sep=tab}

\begin{document}

\pgfplotstableread[format=inline,col sep=tab]{
Timestamp	Open	High	Low	Close	Volume (BTC)	Volume (Currency)	Weighted Price	updown
2016-10-10	612.12	616.47	612.12	616	2295.52	1410892.89	614.63	1
2016-10-11	616.37	639	614.56	639	8087.32	5100218.35	630.64	1
2016-10-12	638.3	640	628.76	634.5	2658.53	1690227.11	635.78	1
2016-10-13	634.5	636	630	634.02	2381.5	1510988.67	634.47	0
2016-10-14	635.16	639.99	630.45	638.2	3154.82	2003219.14	634.97	1
2016-10-15	638.2	642	635.25	635.96	1421.85	908251.54	638.78	1
2016-10-16	635.26	641.4	635.18	638.97	1289.54	823539.55	638.63	0
2016-10-17	638.97	639.99	632.1	636.91	3958.04	2516207.28	635.72	0
2016-10-18	636.96	637.8	631.52	635.95	2731.18	1735476.56	635.43	0
2016-10-19	635.95	638.04	624.13	627.98	4472.9	2824080.05	631.38	0
2016-10-20	627.84	630.22	625	628.89	2040.01	1280448.68	627.67	0
2016-10-21	628.05	632.36	627.5	629	3050.51	1919969.05	629.39	1
2016-10-22	628.99	656	628.57	654.52	4351.62	2812594.62	646.33	1
2016-10-23	654.52	656	647.51	648.74	2535.01	1651700.19	651.56	1
2016-10-24	648.71	652.25	640	648.6	4679	3027622.03	647.07	0
2016-10-25	649.03	657.58	643	651.97	6106.92	3982507.67	652.13	1
2016-10-26	651.97	677	651.69	675.11	6716.23	4466380.41	665.01	1
2016-10-27	674.63	685.89	665.59	684.71	4545.44	3090089.93	679.82	1
2016-10-28	684.68	687.23	677.05	685.91	3574.08	2446577.64	684.53	1
2016-10-29	685.91	717.99	684.89	711.13	4034.88	2839203.57	703.66	1
2016-10-30	711.1	711.78	691.49	697.23	3752.53	2630802.8	701.08	1
2016-10-31	697.1	706.97	683.6	697.01	4655.89	3246833.13	697.36	0
2016-11-01	697.04	737	695.38	726.6	6570.02	4746887.12	722.51	1
2016-11-02	726.6	742	717.32	742	4320.53	3133467.19	725.25	1
2016-11-03	742	745.19	670.32	685.22	12102.24	8620853.88	712.34	0
2016-11-04	684.84	707.67	681	702.7	5345.68	3725359.65	696.89	0
2016-11-05	702.95	707.34	694.71	703.46	1918.31	1346262.96	701.8	1
2016-11-06	703.33	714.36	697.92	709.93	2292.86	1620784.56	706.88	1
2016-11-07	709.92	709.92	698.26	702.86	3020.87	2123754.48	703.03	0
2016-11-08	702.86	712.92	701.02	709.31	5526.47	3905868.36	706.76	1
2016-11-09	708.17	740.86	705.45	721.5	9726.25	7081641.53	728.1	1
2016-11-10	721.5	722	707	714.47	4996.45	3570538.74	714.61	0
2016-11-11	714.48	720.94	712.24	716.39	3328.33	2382869.96	715.94	1
2016-11-12	716.39	716.39	701	702.28	2811.55	1988237.32	707.17	0
2016-11-13	701.17	702.89	683.23	700.38	6023.55	4174451.24	693.02	0
2016-11-14	700.38	705.89	697.14	703.82	7566.58	5302237.19	700.74	1
2016-11-15	704.98	716.54	703.05	711.06	5668.94	4030616.4	711	1
2016-11-16	711.07	742.87	708.44	739.71	11585.05	8443845.52	728.86	1
2016-11-17	739.71	749.98	732.22	735.24	6681.43	4971520.49	744.08	1
2016-11-18	736	752.95	731.31	748.98	4271.04	3180459.44	744.66	1
2016-11-19	748.98	755.07	742.63	750.75	1965.44	1470296.81	748.08	1
2016-11-20	750.09	753.82	714	727.09	5525.96	4046316.48	732.24	0
2016-11-21	727.09	739.2	727.03	736.76	4017.58	2948982.13	734.02	1
2016-11-22	736.92	750	730.27	749.22	5034.7	3735123.75	741.88	1
2016-11-23	749.13	749.98	729.92	740.18	4462.78	3298351.61	739.08	0
2016-11-24	740.18	741.15	729	735.63	4039.82	2967466.39	734.55	0
2016-11-25	735.63	737.07	728	737.07	3356.09	2459029.2	732.71	0
2016-11-26	736.96	737.56	722.3	729.91	2314.58	1685262.3	728.11	0
2016-11-27	729.91	732	722.44	727.32	3447.87	2508288.05	727.49	0
2016-11-28	727.32	732.44	724.1	729.54	4741.12	3457223	729.2	1
2016-11-29	730.99	733.29	721	730.76	5406.9	3944721.68	729.57	1
2016-11-30	730.72	744.49	727	742.06	6249.62	4608044.88	737.33	1
2016-12-01	742.06	754.98	740.18	751.54	6124.5	4590130.15	749.47	1
2016-12-02	751.55	778.07	750.77	769.99	8098.58	6209209.26	766.7	1
2016-12-03	770.91	770.99	752.41	760.75	2772.66	2114389.56	762.58	0
2016-12-04	762.97	762.97	752.41	762	3215.68	2440424.84	758.91	0
2016-12-05	762	762.09	743	750.24	5567.77	4175776.97	749.99	0
2016-12-06	749.51	759.9	747.99	758.98	6763.74	5108421.86	755.27	1
2016-12-07	758.97	769.61	751.78	763.99	4809.71	3665122.08	762.03	1
2016-12-08	764.05	772.01	762.29	771.28	3224.88	2476559.45	767.95	1
}\btctable

\frame{
	\maketitle

	\includegraphics[height=0.5cm]{img/by-sa}

	{\tiny This work is licensed under the\\ Creative Commons Attribution-ShareAlike 3.0 Austria license\\ (CC-BY-SA)}
}


\begin{frame}[fragile]{2D value plot}
\pgfplotsset{compat=1.3}
\begin{center}
\begin{tikzpicture}[
	font=\tiny,
]
	\begin{axis}[
		title={Bitstamp USD},
		ybar,
		bar shift=0,
		bar width=2pt,
		date coordinates in=x,
		x tick label style={rotate=65,anchor=east},
		axis y line*=left,
		ylabel={Volume / BTC},
		scaled y ticks=false,
		enlarge y limits=upper,
		ymin=150,
		%yticklabel = {
		%	\pgfmathparse{\tick/1000}
		%	\pgfmathprintnumber{\pgfmathresult}\,K
		%}
		%y tick label style={
		%	/pgf/number format/fixed,
		%	/pgf/number format/fixed zerofill,
		%	/pgf/number format/precision=1
		%}
	]

	\addplot[
		draw=none,
		fill=green!35,
		%discard if={updown}{0}
	]
	table[
		x=Timestamp,
		y={Volume (BTC)},
	]
	{btc.csv};

	\addplot[
		draw=none,
		fill=red!35,
		discard if={updown}{1}
	]
	table[
		x=Timestamp,
		y={Volume (BTC)},
	]
	{btc.csv};
	\end{axis}

	\begin{axis}[
		date coordinates in=x,
		%x tick label style={rotate=65},
		axis y line*=right,
		axis x line=none,
		axis y discontinuity=crunch,
		ylabel={Exchange Rate / $\frac{\text{USD}}{\text{BTC}}$},
		smooth,
		enlarge y limits=upper,
		ymajorgrids,
		ymin=100,
		legend columns=3,
		legend style={
			at={(0.5,1)},
			anchor=north
		}
	]

	\addplot[black,
	%error bars/y dir=plus,error bars/y explicit
	]
	table[
		x=Timestamp,y=Weighted Price,
		%y error expr={\thisrow{High}}
	] from \btctable;
	\addlegendentry{Weighted Price}

	\addplot[green]
	table[x=Timestamp,y=High] from \btctable;
	\addlegendentry{High}

	\addplot[red]
	table[x=Timestamp,y=Low] from \btctable;
	\addlegendentry{Low}

	\end{axis}
\end{tikzpicture}
\end{center}
\end{frame}


\begin{frame}{2D function plot}
\begin{center}
\begin{tikzpicture}
	\begin{semilogyaxis}[
		title={$x^2 - y = 0$},
		xlabel=$x$,
		ylabel=$y$,
		domain=-10:10,
		samples=100,
	]
		\addplot%
		[mark=x,blue]
		{x^2};
	\end{semilogyaxis}
\end{tikzpicture}
\end{center}
\end{frame}


\begin{frame}{3D function plot}
\begin{center}
\begin{tikzpicture}
	\begin{axis}[colormap/hot,colorbar,title={$\sin(x) \times \cos(y)$}]
		\addplot3%
		[surf,domain=0:360,samples=60]%
		{sin(x)*cos(y)};
	\end{axis}
\end{tikzpicture}
\end{center}
\end{frame}




\begin{frame}{\TikZ{} \& PGF(plots)}

\begin{itemize}
	\item \TikZ{} ist kein Zeichenprogramm
	\item Portable Graphics Format / pretty, good, functional
	\item Usable with \LaTeX, \TeX, Con\TeX{}t
\end{itemize}
\end{frame}

\begin{frame}{\TikZ}

\begin{itemize}
	\item “Program” your graphics
	\item Advantages: quick creation of simple graphics, precise positioning, macros, superior typography
	\item Disadvantages: steep learning curve, no WYSIWYG, compilation times
\end{itemize}
\end{frame}

\begin{frame}{PGFPLOTS}

\begin{itemize}
	\item Draw plots and labeled axes easily
	\item Linear plots, logplots, semi-logplots
	\item 2D and 3D
\end{itemize}
\end{frame}

\part{\TikZ}
\frame{\partpage}

\begin{frame}{\TikZ}{Coordinates}

\begin{columns}[T]
\begin{column}{.5\textwidth}
\begin{itemize}
	\item Many different \emph{coordinate systems}
	\item Always in round brackets
	\item Absolute or relative
	\item Cartesian, Polar, Barycentric, Perpendicular, user-defined, \ldots
\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
	\begin{tikzpicture}[
		font=\tiny,
		coord/.style={
			draw,
			fill,
			circle,
			inner sep=1pt,
			minimum size=2pt,
			pin distance=5pt,
		},
		every pin/.append style={
			rectangle,
			inner sep=1pt,
			pin distance=4pt
		}
	]
		\draw[help lines] (0,0) grid (3,3) ;

		\draw[->] (0,0) -- (0,4) ;
		\draw[->] (0,0) -- (4,0) ;
		\draw[->] (0,0,0) -- (0,0,3.5) ;

		\path[red,text=white,every pin/.append style={text=red}]
			(2,1.5) node[coord,pin=200:{(2,1.5)}](1) {1}
			-- +(0,-1) node[coord,pin=200:{+(0,-1)}](2) {2}
			-- ++(1,0) node[coord,pin=-20:{++(1,0)}](3) {3}
			-- +(0,1) node[coord,pin=-20:{+(0,1)}](4) {4}
			;
		\draw[blue]
			(2) -- (2 -| 3)
			[fill]circle (2pt)
			node[pin={-15:{(2 -$\vert$ 3)}}] {}
			-- (3)
			;

		\node[coord,pin=-90:{(60:3)},pin=30:{polar}](polar) at (60:3) {} ;
		\node[coord,pin=-15:{(0,0,2)},pin={[->]-90:{3d}}](3d) at (0,0,2) {} ;
		\draw
			(3d.north)
				edge[out=north,in=west]
				node[above,sloped,pos=0.4] {(3d.north) -- (polar.west)}
			(polar.west)
			;
	\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}


\begin{frame}{\TikZ}{Paths}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Basic entity of drawing
		\item Consist of parts
		\item Closed or open curves
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
	\begin{tikzpicture}
		\draw (2,2) circle (2) ;
		\draw (1,1.1) to[out=-40,in=220] (3,1.1) ;
		\draw (1.5,2.8) -- (1.5,1.8)
			(2.5,2.8) -- (2.5,1.8) ;
	\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{\TikZ}{Nodes}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Text placed at coordinate
		\item Simple and complex shapes
		\item Anchors for precise positioning
		\item \lstinline{\node} is shorthand for \lstinline{\path node}
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{tikzpicture}[font=\footnotesize]
	% 00ADEF = rgb(0,173,239)
	\definecolor{cloudblue}{rgb}{0,0.678,0.937}
	\node[draw](simple) at (0,0) {\lstinline{\node[draw]}} ;
	\node[fill=red] at (0,1) {[fill=red]} ;

	\node[draw,circle,font=\scriptsize,align=center] at (0,2.5) {[draw, \\ circle]} ;

	\node
		[draw=red,fill=blue,thick,text=white,font=\tiny,rounded corners=4mm,align=left,text width=2.8cm]
		at (3,0)
		{[draw=red, fill=blue, text=white, font=\tiny, thick, rounded corners=4mm]} ;

	\path
	(3,2)
		% 00ADEF
		node[minimum width=3cm,minimum height=2cm,fill=cloudblue,name=box]{}
		node[minimum width=2.5cm,minimum height=1.5cm,fill=white,shape=cloud,inner sep=0,font=\tiny,align=center]{[shape=\\cloud]}
	;

	\node[font=\tiny,above=0 of box]
		{There is NO CLOUD, just}
		;
	\node[font=\tiny,below=0 of box]
		{other people's computers}
		;

\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{\TikZ}{Nodes: Labels and Pins}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Add nodes to existing nodes
		\item Can be called multiple times per node
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
font=\scriptsize,
%every label/.append style={font=\tiny}
]

	\node[
		draw,circle,
		label=east:east,
		label=below right:below right,
		label=above left:above left,
		label={60:$60^\circ$},
		label={-135:$-135^\circ$},
		label={pi r:$\pi$r}
	]
	{labels}
	;

	\node[
		draw,circle,
		pin=east:east,
		pin=above left:above left,
		pin={60:$60^\circ$},
		pin={-135:$-135^\circ$},
		pin={pi r:$\pi r$}
	]
	at (0,2.5)
	{pins}
	;

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{\TikZ}{Nodes: Matrices}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Mostly treated like nodes
		\item Similar to tabular environment
		\item Consist of rows of \emph{cells}
		\item Each cell contains a \emph{cell picture}
		\item \lstinline{cell1; & cell2; \\}
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
font=\scriptsize,
]

	\matrix[
		every node/.append style={draw,circle},
		every odd row/.append style={blue},
		every even column/.append style={red},
		row sep=0.5cm,
		column sep=0.5cm
	]
	{
		\node(1a){1a}; & \node(1b){1b}; & \node(1c){1c}; \\
		\node(2a){2a}; & \node(2b){2b}; & \node(2c){2c}; \\
		\node(3a){3a}; & \node(3b){3b}; & \node(3c){3c}; \\
	};
	%\fill[blue] (0,0) circle (2pt);

	\draw[<->]
		(1a.east |- 1a.north) -- (1b.north -| 1b.west)
		node [above,midway] {row sep}
		;

	\draw[<->]
		(1a.south -| 1a.west) -- (2a.north -| 2a.west)
		node [above,midway,rotate=90] {column sep}
		;

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{\TikZ}{Trees}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Visualize hierarchical structures
		\item Customizable growth functions
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
	font=\scriptsize,
	%
	level distance=10mm,
	every node/.style={fill=red!60,circle,inner sep=1pt},
	level 1/.style={sibling distance=12mm,nodes={fill=red!45}},
	level 2/.style={sibling distance=6mm,nodes={fill=red!30}},
	level 3/.style={sibling distance=4mm,nodes={fill=red!25}}
]

	\node {24}
		child {node {7}
			child {node {3}
				child {node {1}}
				child {node {2}}
			}
			child {node {4}}
		}
		child {node {8}}
		child {node {9}
			child {node {2}}
			child {node {3}
				child {node {1}}
				child {node {2}}
			}
			child {node {4}}
		}
	;

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{\TikZ}{Coordinate transformations}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Rotate, translate, scale, slant
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
	font=\scriptsize,
	%
	every node/.style={draw,rounded corners,inner sep=2pt},
]

\draw[help lines] (-2,-2) grid (2,2) ;

\node[rotate=60] at (-1,0) {rotate=60} ;
\node[scale=2] at (0,1.5) {scale=2} ;
\node[shift={(-1,-1)}] {shift={(-1,-1)}} ;
\node[yslant=-1] at (1,0) {yslant=-1} ;

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}{Libraries}{}
\scriptsize
\begin{columns}[T]
\begin{column}{.5\textwidth}
\begin{itemize}
	\item Arrow tip
	\item Automata drawing
	\item Background
	\item Calc
	\item Calendar
	\item Chains
	\item Circuits (logical)
	\item Circuits (electrical engineering)
	\item Decoration
	\item ER diagram drawing
	\item Externalization
	\item Fading
	\item Fitting
	\item Fixed point arithmetic
	\item Lindenmayer system drawing
	\item Matrix
\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{itemize}
	\item Mindmap drawing
	\item Paper folding diagrams
	\item Pattern
	\item Petri-net drawing
	\item Plot handler
	\item Plot mark
	\item Profiler
	\item Shadings
	\item Shadow
	\item Shape
	\item Spy
	\item SVG-path
	\item To path
	\item Through
	\item Tree
	\item Turtle graphics
\end{itemize}
\end{column}
\end{columns}
\end{frame}


\part{PGFPLOTS}
\frame{\partpage}



\begin{frame}[fragile]{PGFPLOTS}{Plots}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Plots contained in \lstinline{axis} environment
		\item \lstinline{\addplot}
		\item Data inline or from file
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
]

\begin{axis}[
width=6cm,
unbounded coords=jump
]
	\addplot coordinates {
		(3,8)
		(4,-1)
		%(3,2)
		(5,10)
		(6,9)
		(7,inf)
		(8,4.4)
		(9,7.2)
		(15,8)
		(17,1)
		(18,10)
		(20,10)
		(21,-4)
	};
\end{axis}

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{PGFPLOTS}{Plots: \textbackslash addplot}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item coordinates, file, table, expression
		\item \lstinline{\addplot}, \lstinline{\addplot+}
		\begin{itemize}
			\item const plot, sharp plot, smooth, x/ybar (interval), x/ycomb, only marks, scatter, mesh
		\end{itemize}
		\item \lstinline{\addplot3}, \lstinline{\addplot3+}
		\begin{itemize}
			\item sharp plot, smooth, scatter, only marks, mesh, surf
		\end{itemize}
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
	font=\footnotesize,
]

\begin{axis}[
	width=5cm,
	mark size=1pt,
	legend style={font=\tiny,at={(0.5,1.03)},anchor=south},
	legend pos=outer north east
]

	\addplot+[const plot,mark=none] {sin(deg(x))} ;
	\addlegendentry[align=left]{expr:\\ sin(x)}

	\addplot+[smooth] coordinates {
		(0,1)
		(1,3)
		(2,2)
		(3,-2)
		(4,0)
		(5,0)
		(6,4)
		(7,5)
	} ;
	\addlegendentry{coords}

	\addplot+[ycomb] file[skip first] {plot.dat} ;
	\addlegendentry{file}

	\addplot+[
		sharp plot,
		xshift=2pt,
		error bars/y dir=both,
		error bars/y explicit
	]
	table[x=x,y=y,y error=error]
	{plot.tab}
	;
	\addlegendentry{table}

\end{axis}

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{PGFPLOTS}{Plots: Automatic style cycling}

\begin{columns}[T]
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Plot styles from a predefined list
		\item Used for plot lines and legend entries
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
	font=\footnotesize,
]

\begin{axis}[
width=6cm,
legend columns=3,
legend style={font=\tiny,at={(0.5,1.03)},anchor=south},
mark size=1pt,
domain=-7:7,
ymin=-200, ymax=200,
]

	\foreach \e in {0,1,2,3,4,5}{
		\addplot {x^\e};
		\addlegendentryexpanded{$x^\e$}
	}
\end{axis}

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile,shrink]{PGFPLOTS}{Plots: styles}

\begin{columns}[T]
\small
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item solid, (densely/loosely) dotted, (densely/loosely) dashed
		\item thin, ultra thin, very thin, semithick, thick, very thick, ultra thick
		\item red, green, blue, cyan, magenta, yellow, black, gray, white, darkgray, lightgray, brown, lime, olive, orange, pink, purple, teal, violet
		\item mark=*, x, +, -, $\vert$, o, asterisk, star, oplus(*), otimes(*), square(*), triangle(*), diamond(*), pentagon(*), cube(*), text, \emph{user defined}
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[
	font=\footnotesize,
]

\begin{axis}[
	width=5cm,
	mark size=2pt,
	legend style={font=\tiny,at={(0.5,1.03)},anchor=south},
	legend pos=outer north east,
	stack plots=y,
	solidmark/.style={
		every mark/.append style={solid,fill=lightgray},
	}
]
	\newcommand\add[1]{
		\addplot[#1] coordinates {
			(0,1)
			(1,3)
			(2,2)
			(3,-2)
			(4,0)
			(5,0)
			(6,4)
			(7,5)
		} ;
	}

	\add{solidmark, solid, thick, draw=red, mark=*}
	\add{solidmark, dashed, thin, draw=green, mark=diamond}
	\add{solidmark, dotted, very thick, draw=blue, mark=+}
	\add{solidmark, densely dotted, very thin, draw=cyan, mark=star, text=black}
	\add{solidmark, loosely dashed, semithick, draw=magenta, mark=oplus*}
\end{axis}

\end{tikzpicture}
\begin{tikzpicture}[
	font=\footnotesize,
]

\begin{axis}[
	width=5cm,
	domain=0:-pi/2,
	y domain=0:pi/2,
	ylabel=$y$,
	xlabel=$x$,
	z buffer=sort,
	colorbar,
	colormap/cool,
	colorbar style={
		font=\tiny,
		width=1mm
	}
]
	\addplot3
		[only marks,scatter,mark=cube*,mark size=5,samples=13]
		{ - sqrt(cos(deg(x)) * cos(deg(y))) }
		;
\end{axis}

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}[fragile]{PGFPLOTS}{Plots: descriptions}

\begin{columns}[T]
\small
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item title
		\item x/ylabel
		\item legend
		\item ticklabel style
		\item axis x/y line
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\pgfplotsset{compat=1.3}
\begin{tikzpicture}[
	font=\footnotesize,
]

\begin{axis}[
	width=5cm,
	title=title,
	ylabel=ylabel,
	xlabel=xlabel,
	xlabel near ticks,
	ylabel near ticks,
	axis x line=middle,
	axis y line=left,
	legend pos=north west,
	clip=false,
	ticklabel style={red},
	xlabel style={xshift=3mm}
]

	\addplot[blue,semithick] coordinates {
		(0,1)
		(1,3)
		(2,2)
		(3,-2)
		(4,0)
		(5,0)
		(6,4)
		(7,5)
	} ;

	\legend{legend}

	\node[scale=0.3,pin={[font=\tiny,pin distance=1mm,anchor=north west]south east:{(axis cs:3,-2)}}] at (axis cs:3,-2) {} ;

\end{axis}

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}




\begin{frame}[fragile]{PGFPLOTS}{Number formatting}

\begin{columns}[T]
\small
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Pretty-print numbers
		\item \lstinline+\pgfmathprintnumber[...]{...}+
		\item fixed, sci, std, frac, …
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{itemize}
	\item std: \pgfmathprintnumber[std]{12304567.89}
	\item fixed: \pgfmathprintnumber[fixed]{12304567.89}
	\item fixed, zerofill: \pgfmathprintnumber[fixed,zerofill,precision=3]{12304567.89}
	\item sci: \pgfmathprintnumber[sci,precision=3]{12304567.89}
	\item sci, sci e: \pgfmathprintnumber[sci,sci e,precision=3]{12304567.89}
	\item sci, zerofill: \pgfmathprintnumber[sci,zerofill,precision=3]{12304567.89}
	\item frac: \pgfmathprintnumber[frac,precision=3]{12304567.89}
	\item frac, frac whole=false: \pgfmathprintnumber[frac, frac whole=false,precision=3]{12304567.89}
\end{itemize}
\end{column}
\end{columns}
\end{frame}




\begin{frame}[fragile]{PGFPLOTS}{Plots: Tick options}

\begin{columns}[T]
\small
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item \lstinline{xtick/ytick/ztick=} \lstinline{\empty}, data, \emph{coordinate list}
		\item \lstinline+{0,1,3.5,2e1}+, \lstinline+{0,...,5}+, \lstinline+{0,2,...,5}+, \lstinline+{9,...,3.5}+
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\pgfplotsset{compat=1.3}
\begin{tikzpicture}[
	font=\footnotesize,
]

\begin{axis}[
	width=5cm,
	ticks=both,
	xtick={-9,1,50,2e2},
	ytick={4,8,...,18},
	tick label style={font=\tiny},
	x tick label style={rotate=90},
]

\addplot coordinates {
	(1, 8)
	(50, 18)
	(2e2, 10)
};

\end{axis}

\end{tikzpicture}
\end{center}
\end{column}
\end{columns}
\end{frame}




\begin{frame}[fragile]{PGFPLOTS}{Plots: Grid options}

\begin{columns}[T]
\small
\begin{column}{.5\textwidth}
	\begin{itemize}
		\item Minor grids
			\begin{itemize}
				\item xminorgrids
				\item yminorgrids
				\item zminorgrids
			\end{itemize}
		\item Major grids
			\begin{itemize}
				\item xmajorgrids
				\item ymajorgrids
				\item zmajorgrids
			\end{itemize}
		\item grid=major/minor/both
	\end{itemize}
\end{column}

\begin{column}{.5\textwidth}
\begin{center}
\foreach \grid in {minor,major,both} {
\begin{tikzpicture}[ scale=0.6 ]
\begin{loglogaxis}[
	width=6cm,
	grid=\grid,
	mark size=1pt,
	xticklabel style={font=\tiny,rotate=30},
	footnotesize,
	title style={at={(-0.15,0.5)},rotate=90},
	title=\grid
]
\addplot { x^2 };
\end{loglogaxis}
\end{tikzpicture}
}
\end{center}
\end{column}
\end{columns}
\end{frame}



\begin{frame}{References}

\begin{itemize}
	\item \url{http://pgf.sourceforge.net}
	\item \url{http://pgfplots.sourceforge.net}
	\item \url{http://en.wikibooks.org/wiki/LaTeX/PGF/TikZ}
	\item \url{http://tex.stackexchange.com}
	\item \url{http://texample.net/tikz}
\end{itemize}
\end{frame}

\end{document}
