Experiments with matplotlib
Mar. 30th, 2011 08:43 pmI've been doing quite a lot of work with python and numpy and matplotlib of late and I've made a couple of useful discoveries:
- numpy structured arrays are an almost perfect replacement for tables in R, provided that you don't try to use the
dtypeparameter to explicitly request a field type of|O4, e.g. to accomodatedatetimeobjects, because (a) this seems to cause the current version of numpy to complain; and (b) seems to be unnecessary. - using matplotlib.ticker.FixedLocator to override the standard X-axis ticks provides cleaner labelling than most of the other methods when working with time/date sequences.
- doing a
yaxis.get_major_ticks()[0].label1On = Falseswitches off the first label of the Y-axis, avoiding ugly collisions between labels on the two different axes.
I've used these discoveries to put together a script that plots out nmon and topas data for one or more machines, making it easy to compare and contrast the performance of nodes that share the provision of a service, e.g. GPFS, LoadLeveler etc.