Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is an extension of my previous question concerning graphing a pair of functions using pgfplots (please see link below):

Could somebody figure out how to create the following graph using pgfplot?

I am trying to use the code from the previous solution I was given to produce the following functions (with labels etc./no shading) below:

Gauss picture

However, I have been running into trouble, and getting something else. So far, this is what I have come up with in terms of code:

\begin{tikzpicture}[
every pin edge/.style={<-},
every pin/.style={fill=yellow!50,rectangle,rounded corners=3pt,font=\small}]
\begin{axis}[every axis plot post/.append style={
  mark=none,domain=-5:5,samples=50,smooth},
clip=false,
axis lines=none
]
\addplot {\gauss{-1.5}{1}};
\addplot {\gauss{1}{3}};
\addplot {\gauss{3}{3.1}};
\node[pin=70:{Most efficient: p(v) has lease MSE}] at (axis description cs:0.47,0.6) {};
\node[pin=70:{p(u) has the lease bias}] at (axis description cs:0.65,0.3) {};
\node[pin=70:{p(w) has the lease variance}] at (axis description cs:0.85,0.3) {};
\node[pin=270:{$\theta$}] at (axis description cs:0.5,0.1) {};
\draw[dashed] (axis description cs:0.5,0) -- (axis description cs:0.5,0.92);
\end{axis}
\end{tikzpicture}
share|improve this question
    
Related: tex.stackexchange.com/questions/43610/… –  hpesoj626 Oct 26 '12 at 23:44
    
I edited my answer to the other question, and changed to the axis cs coordinate system. –  Gonzalo Medina Oct 27 '12 at 2:26
add comment

1 Answer

up vote 4 down vote accepted

Here's a possibility; this time, I used the axis cs coordinate system (I wasn't sure about the position of the theta and its arrow since the original drawing is not clear in this part):

\documentclass{article}
\usepackage{pgfplots}

\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))} 
% Gauss function, parameters mu and sigma

\begin{document}

\begin{tikzpicture}[
every pin edge/.style={<-},
every pin/.style={fill=yellow!50,rectangle,
  rounded corners=3pt,font=\footnotesize},
mylabel/.style={fill=yellow!50,rectangle,
  rounded corners=3pt,font=\footnotesize,align=center}]
\begin{axis}[every axis plot post/.append style={
  mark=none,domain=-8:20,samples=50,smooth},
clip=false,
axis lines=none,
]

\def\puxpos{1}
\def\pvxpos{2.5}
\def\pwxpos{16}

\addplot {\gauss{\puxpos}{3}};
\addplot {\gauss{\pvxpos}{1}};
\addplot {\gauss{\pwxpos}{0.75}};

\draw[dashed] (axis cs:\pvxpos,0) -- (axis cs:\pvxpos,0.4);
\draw[dashed] (axis cs:\pwxpos,0) -- (axis cs:\pwxpos,0.5);

\node[pin=270:{$\theta$}] at (axis cs:1,0.065) {};
\node[mylabel] at (axis cs:\pvxpos,0.48) (pv) {MOST EFFICIENT \\ $V$ has least MSE \\ $p(v)$};
\node[mylabel] at (axis cs:-8.4,0.09) (pu) {$U$ has \\least bias \\ $p(u)$};
\node[mylabel] at (axis cs:\pwxpos,0.62) (pw) {$W$ has \\ least variance \\ $p(w)$};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Amazing! Thank you very much! –  ealfons1 Oct 27 '12 at 13:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.