How it works…
The code starts by generating a plot of the probability mass function of a Gamma distribution, which is a well-known example of skewed distribution. After importing the gamma object from scipy.stats, the distribution is created with distr = gamma(2.0). The value of 2.0 for the parameter is chosen to generate a graph with the desired shape. The points defining the plot are then computed in the xvalues and yvalues arrays and the plot() function is called to create the line plot. After that, we add a title and labels for the axes with the title(), xlabel(), and ylabel() functions, respectively.
After the line plot is set up, we start working on the annotations. The first step is to compute the mean and median of the distribution ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access