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!!

enter image description here

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.

    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)$};
    \addplot[red] {ifthenelse(x>0.5,-x+3,3*x+1)};
    \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}$};

enter image description here

  • 1
    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
  • Thank you so much!!!! I will try out how it works. Really, thank you!! – hpz1719 Jun 25 '16 at 5:41
  • @hpz1719 Posting a thank-you comment is of course nice, but upvoting and accepting answers is the preferred way here. – Henri Menke Jun 25 '16 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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