Skip to content

Instantly share code, notes, and snippets.

@windstriver
Created August 30, 2015 00:49
Show Gist options
  • Save windstriver/5510d6afdb033cfb2dd3 to your computer and use it in GitHub Desktop.
Save windstriver/5510d6afdb033cfb2dd3 to your computer and use it in GitHub Desktop.
Data visualization example from TikZ & PGF Manual
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{datavisualization}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}
\begin{tikzpicture}
\datavisualization [scientific axes=clean]
[
visualize as smooth line=Gaussian,
Gaussian={pin in data={text={$e^{-x^2}$},when=x is 0.5}},
]
data [format=function] {
var x : interval [-7:7] samples 51;
func y = exp(-\value x*\value x);
}
[
visualize as scatter,
legend={south outside},
scatter={
style={mark=*,mark size=0.6pt},
label in legend={text={
$\sum_{i=1}^{10} x_i$, where $x_i \sim U(-1,1) $}}},
]
data [format=function] {
var i : interval [0:1] samples 20;
func y = 0;
func x = (rand + rand + rand + rand + rand +
rand + rand + rand + rand + rand);
};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment