Continuing my series on using python and matplotlib to generate common plots and figures, today I will be discussing how to make histograms, a plot type used to show the frequency across a continuous or discrete variable. Histograms are useful in any case where you need to examine the statistical distribution over a variable in some sample, like the brightness of radio galaxies, or the distance of quasars.
Continuing my series on using matplotlib and python to generate figures, I’d like to get now to the meat of the topic: actually making a figure or two. I’ll be starting with the simplest kind of figure: a line plot, with points plotted on an X-Y Cartesian plane.
I’m sure many of my fellow scientists spend a relatively large chunk of their time making plots, graphs, and figures of one sort or another. There are a plethora of cool tools out there for doing this, from proprietary tools like Mathematica or IDL to free software kits like GNUplot. While GNUplot is useful and handy (and IDL is powerful and expensive), I’m a python guy primarily, so I like my tools to interface well with my existing code, and has a more pythonic interface. For this, I turn to matplotlib, a powerful suite for generating all sorts of plots from python.