I was try to plot the Poisson distribution as a discrete graph and only found continuous graph examples like this:

Poisson distribution with tikzpicture

Formula is:

&space;0" target="blank">&space;0" title="P{\lambda}(k) = \frac{\lambda^k}{k!}e^{-\lambda} \quad for \quad k \in \mathbb{N}_0,\quad \lambda > 0" />

How can I plot the discrete graph? Poisson distribution


1 Answer 1


This is how to plot the discrete Poisson function. Added ycomb to the example from the link, this makes the plot discrete and not continuous.

\usepackage{pgfplots, tikz}
              axis x line=center,
              axis y line=center,
                domain = 0:18,
                samples = 19,
                xlabel style={right},
                ylabel style={above left},
                x post scale=1.4
                \addplot+[ycomb,blue,thick] {poiss(1))};
                \addlegendentry{$\lambda = 1$}
                \addplot+[ycomb,red,thick] {poiss(5))};
                 \addlegendentry{$\lambda = 5$}
                \addplot+[ycomb,brown,thick] {poiss(9))};
                 \addlegendentry{$\lambda = 9$};

Plot of the poisson function

  • 3
    while in general a self answer is OK on the site, what is the point here? You ask a question that is too vague for anyone to answer and then immediately post the answer? Commented Dec 12, 2015 at 20:46
  • I only found this answer tex.stackexchange.com/questions/170068/… Which is incorrect, so I wanted to post a correct example how to plot the Poisson distribution Commented Dec 13, 2015 at 9:46
  • 1
    If I understand correctly, the core difference to the code you linked to is that you added the ycomb option, right? Maybe you could add that to your answer so it's clearer for others who come across the same problem?
    – Jake
    Commented Dec 13, 2015 at 13:20
  • The other plot is mathematical incorrect. Commented Dec 13, 2015 at 23:35
  • 1
    If that answer is incorrect, wouldn't it be better to post a correct answer to that question? And, preferably, leave a comment explaining why the accepted answer is wrong. [There is something wrong with the code in that answer, but that's just a question of a missing curly bracket.] The way you've done this, anybody looking for an answer who finds the other question will have no clue to look for yours, which is a shame if yours is right and the other wrong, as you claim.
    – cfr
    Commented Dec 14, 2015 at 2:49

Not the answer you're looking for? Browse other questions tagged .