2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
This commit is contained in:
Martin Thoma 2014-08-13 12:27:59 -04:00
parent 5036128de1
commit ecd37b480d
2 changed files with 41 additions and 16 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before After
Before After

View file

@ -1,4 +1,4 @@
\documentclass[varwidth=true, border=4pt]{article}
\documentclass[varwidth=true, border=5pt]{article}
\usepackage[active,tightpage]{preview}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
@ -18,16 +18,18 @@ every axis label/.append style={font=\sffamily\footnotesize},
\begin{document}
\begin{preview}
\tikzstyle{plotA}=[ultra thick,red!90!black]
\tikzstyle{plotB}=[ultra thick,cyan!50!black]
\begin{tikzpicture}
\begin{axis}[
width=13.5cm,
height=8.625cm,
% Grid
grid = major,
grid style={black, thin},
%grid style={thin, dashed},
% size
xmin= 0, % start the diagram at this x-coordinate
xmax= 120, % end the diagram at this x-coordinate
xmax= 125, % end the diagram at this x-coordinate
ymin= 0, % start the diagram at this y-coordinate
ymax= 0.045, % end the diagram at this y-coordinate
% Legende
@ -41,30 +43,53 @@ every axis label/.append style={font=\sffamily\footnotesize},
},
% Ticks
tick align=inside,
minor tick num=3,
%minor tick num=3,
minor tick style={thick},
scaled y ticks = false,
yticklabel={\pgfmathparse{\tick*100}\pgfmathprintnumber{\pgfmathresult}\%},
yticklabel style={
%/pgf/number format/precision=2,
/pgf/number format/fixed,
%/pgf/number format/fixed zerofill
},
xtick={40,70,80},
ytick=\empty,
% yticklabel={\pgfmathparse{\tick}\pgfmathprintnumber{\pgfmathresult}},
% yticklabel style={
% %/pgf/number format/precision=2,
% /pgf/number format/fixed,
% %/pgf/number format/fixed zerofill
% },
% Axis
axis lines = middle,
axis line style = very thick,
xlabel=$x$,
x label style={at={(axis description cs:0.5,0)},
anchor=north,
font=\boldmath\Large},
ylabel=$\mathcal{N}_{\mu, \sigma^2}(x)$,
y label style={at={(axis description cs:0.05,0.5)},
ylabel=$f(x)$,
y label style={at={(axis description cs:0,0.5)},
anchor=south,
rotate=90,
font=\boldmath\Large},
]
\addplot [domain=0:120,ultra thick,red!90!black,samples=200,] {gauss(80,100)};
\addplot [domain=0:120,ultra thick,cyan!50!black,samples=200] {gauss(40,100)};
\addlegendentry{$\mu=80,\enskip \sigma^2 = 100$}
\addlegendentry{$\mu=40,\enskip \sigma^2 = 100$}
% Plots of the distributions
\addplot [domain=0:120,samples=200,plotA] {gauss(80,100)};
\addplot [domain=0:120,samples=200,plotB] {gauss(40,100)};
% Mark points
\addplot+[plotA,
samples at={70},
mark=*,
mark options={scale=1, fill=red!90!black}] {gauss(80,100)}
node[pin={95:\large$f_I(x_0) = 70$}] {};
\addplot+[plotB,
samples at={70},
mark=*,
mark options={scale=1, fill=cyan!50!black}] {gauss(40,100)}
node[pin={10:\large$f_{II}(x_0) = 70$}] {};
\coordinate (a) at (axis cs:70,0.024);
\draw[black,thick](a |- current plot begin) -- (a);
% Add labels
\node[plotA,above] at (axis cs:100,0.03){\Large $\mathcal{N}(80, 100)$};
\node[plotB,above] at (axis cs:20,0.03){\Large $\mathcal{N}(40, 100)$};
% \addlegendentry{$\mu=80,\enskip \sigma^2 = 100$}
% \addlegendentry{$\mu=40,\enskip \sigma^2 = 100$}
\end{axis}
\end{tikzpicture}
\end{preview}