As part of my drive to get more of my work published as open source downloads (see software tab above) I have been busy tiding up some of my python scrips. Mostly this has just involved going back over them and adding notes (something I should have done from the start!) and making sure they are a little more user friendly. Most of the scripts were written to run calculations and data analysis on large arrays of data which are then re-saved as raw data files. Python is so dammed efficient at running analysis like this it is great to use.

However, it’s not very user friendly and probably only of use to the person that wrote the code and knows what’s going on. So I thought I would delve a little deeper into python and add some nice visualisations of my data into the python code rather than using external imaging systems which involve re-loading the processed data into a secondary program. One of the key reasons for doing this is that it makes anything I do multi-platform because as the blurb for python says;

Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.

So having all the data visualisation within python is the best way to share it with a wide audience – especially as I’m writing most of this using a Mac and it’s a pain making sure that all my clever visualisation apps have a windows equivalent. Sadly for me when they said “Python runs on Windows, Linux/Unix, Mac OS X” it turns out they just meant ‘runs’ not ‘works seamlessly’ so what I hoped would be a simple bolting on of a visualisation package has been….not fun.

There are many visualisation packages available for python and I decided to start with VisVis. VisVis is a fantastic package for plotting both 2D and 3D graphs and came highly recommended for visualising large complex datasets like the ones I am working with. So with naive enthusiasm, I went through the installation instructions and ran the simple example…



I then double-checked all the versions of every related package – python, my OpenGL drivers and even double checked my mouse had batteries in it (not sure how that helped but you never know with python). Finally with some trepidation, I went to the develop discussion forum for VisVis. From experience, I know that python discussion forums are basically the equivalent of trying to read hyrogplyhs to those not already 8th level experts in the code. I get the feeling that to answer a call for help in a python forum without using the phrase “so you edit line X of the source code to just de-couple the memory” breaks some kind of un-written rule. But despite all my fears, I did find a reference to a similar problem – although the thread just seemed to stop before any solution was posted. So I posted my problem and sat back and waited patiently for a reply that would surely fix everything…

Just kidding. After posting my question, I immediately moved on to trying to get the ‘still very good but lacking 3D visualisation package’ Matplotlib working. Matplotlib is very widely used and is pretty much at the top of any list of how to visualise data in python – everyone uses it for 2D plots and it is advertised as being very cross-platform compatible. Or at least it is if you read the installation instructions and don’t do what I did and waste 30 minutes trying to get it to install using the pip install command which I use to install literally everything else in python, it never occurredd to me that Matplotlib is so friendly that they even made a simple installer program to load it on to your computer. So having now spent a considerable time on this, I loaded up some example code and…..


not included in the figure is me hugging the screen

LATE BREAKING UPDATE: One reason I love python is that despite my misgivings about the online help being a bit impenetrable, there is a huge community of people posting help all the time to try and solve problems and build a better set of packages – completely free of charge. Sure enough, late last night, the developer of VisVis replied to my call for help with some great advice and possible solutions to my issues of it not rendering a window, and with his help I managed to get…Now all I need to do is add this to all my code – simple 🙂



Okay so I’m still working on it, but I’m sure between us we’ll crack it!

Hi there!

Sign up to receive awesome cartoony content in your inbox, every month.

We don’t spam! Read our privacy policy for more info.

Categories: ErrantWritings


Leave a Reply