How to use lognormal distributions in Python

I’ve made an iPython Notebook that explains how to use lognormal distributions in Python/SciPy.  Python is a free and open source programming language that is becoming increasingly popular with scientists as a replacement for Matlab or IDL.  I hope that the notebook will be helpful to anyone who works with grainsize data e.g. volcanologists, sedimentologists, atmospheric scientists.  View it by clicking the picture below:

iPython Lognormal distributions notebook

iPython notebooks contain formula, code, equations and text. Click for notebook on Using the Lognormal Distribution in Python.

The page includes a button to download the notebook so that you can play around with it on your own machine.

iPython notebooks are amazing; if you use Python for science and haven’t tried them yet, then I urge you to have a look.  They let you run Python code in little chunks, displaying the results immediately and interspersed with comments and LaTeX-rendered equations.  You can also render publicly-available notebooks using the iPython Notebook Viewer website, as I have done here.  I think that they are The Future.

iPython notebooks come nicely packaged for Windows and Mac in the Anaconda Python distribution (and probably others such as Enthought, too).  You can install the ipython-notebook package on Ubuntu-like Linux distributions with a single command (sudo apt-get install ipython-notebook), but to get the most up-to-date versions it is better to use pip:

sudo apt-get install python-pip
sudo pip install ipython

# Depending on what is already installed, 
# you may also need to add some dependencies.

sudo apt-get install pandoc python-zmq python-tornado
Categories: Uncategorized


  1. Jeff says:

    Thanks for this. The lognormal distribution in scipy is very confusing, but your write up was the most clear description of it I’ve found so far.

  2. Gang says:

    Awesome work. I appreciate what did and I am also happy to know people like you who really digs in and makes clear sense of the statistics concept!

  3. abe says:


Leave a comment:

Your email address will not be published. Required fields are marked *