# Drawing a graph with two functions

I would really like to have a graph as you can see on the picture below. But I do not have any idea how I can realize this with latex. I am sorry for asking you like this, but I am quite new with this stuff. I hope someone may help me. Thank you!!

Source of the picture: http://www.uni-saarland.de/fak1/fr12/albert/files/ss07/Spiel-Kap2.pdf

• pgfplots or using gnuplot and exporting it? – user31729 Jun 24 '16 at 19:21

Of course, one could add more eyecandy to it, but it should convey the proper message.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
xlabel=$p$,ylabel=$\pi_1$,
domain=0:1,xmin=0,xmax=1,
ymin=0,ymax=4.2,
no marks,clip=false]
\addplot[dashed] { -x+3} node[above,sloped,pos=0.2] {$\pi_1((p,1-p),T)$};
\addplot[dashed] {3*x+1} node[above,sloped,pos=0.7] {$\pi_1((p,1-p),H)$};
\draw[dotted,red] (axis cs:0,5/2) node[left] {$\underline{v} = \frac{5}{2}$}
-| (axis cs:0.5,0) node[below] {$\hat{p} = \frac{1}{2}$};

• Nice answer (+1) :-), however, it is good habits always to document (in preamble) add \pgfplotsset{compat=1.13} (this is today last version) to indicate which version of \pgflpots is used. And with this version instead (axis cs:0,5/2) you can write just (0,5/2) – Zarko Jun 24 '16 at 20:05
• @Zarko True, but adding the latest compat` might make the code fail on OP's machine due to outdated TeXlive. Ubuntu 14.04LTS for example packages TL2013 and many users haven't yet updated to 16.04LTS. – Henri Menke Jun 24 '16 at 20:09