[SciPy-User] getting started with arrays and matplotlib

David Warde-Farley wardefar at iro.umontreal.ca
Mon Aug 8 01:29:44 EDT 2011


On 2011-08-07, at 5:22 PM, Chris Withers wrote:

> Now, first question: what's the best way to build this array given that 
> I may only see the arrival of a new venue a fair way through building 
> the data structure? How can I efficiently say "please add a new row to 
> my array", I don't know what the 4th dimension equivalent is ;-)

It may be worth thinking about whether an ndarray is necessarily the right way to solve this problem. For one thing, you can't append to ndarrays easily. HDF5 tables (via PyTables, for example) are more forgiving in this respect and play nice with NumPy, but there are certainly other options.

> Secondly, once I've populated this, any good examples of how to turn it 
> into a bar chart? (the simple bar chart would be number of sales on the 
> y-axis, weeks before the event on the x-axis, however, what I'd then 
> like to do is split each bar into chunks for each venue's sales, if that 
> makes sense?)


This might give you an example of what you need:

http://matplotlib.sourceforge.net/examples/pylab_examples/bar_stacked.html

but you'd be better off asking on matplotlib-users.

David


More information about the SciPy-User mailing list