Popular Posts

Tuesday, September 20, 2011

NumPy and MatPlotLib

In a recent project, I needed a good way to plot the probability distribution of activation times of phone devices.  I had all the data available, but didn't want to have to plug it all into Excel every time I needed to see the data visualized, so I asked the internet what I needed and it told me that it was probably the hist function in MatPlotLib.  A prerequisite for MatPlotLib is NumPy.  After a medium-sized series of dead ends and red herrings, I determined that the easiest way to access MatPlotLib was to use the exe installers on their public websites even though I didn't initially want my users to have to do that to see the plots.  Turns out that if I wanted to compile NumPy (at least) from source and include it in my project, I'd have to deal with compiling it via GCC and G77 (Fortran 77 compiler) and I'd have to match the compiler version I use to compile NumPy to the compiler that was used to compile the version of Python that I'm running...and I knew I wouldn't do that stuff right on the first try.

Long story short, it was really easy once I selected the correct version of NumPy and MatPlotLib I wanted (note that MatPlotLib links you to the wrong NumPy SourceForge page).  I would suggest that most users just do it that way, it's much more difficult to include those packages in the project.  The documentation is really good for MatPlotLib, at least in the hist function.  NumPy has a lot of good stuff in it too, of course, and I like its docs as well.


When it was all done, I plotted some real data from one of our installs.  It looks rough but it's just about all we need and will get some polish on it.

No comments:

Post a Comment