From: Paul I. <piv...@gm...> - 2011-01-27 19:33:44
|
C M, on 2011-01-27 13:56, wrote: > bars = self.subplot.bar(self.final_dates, top-bot, bottom=bot, align='center') > > I get the error: > > TypeError: unsupported operand type(s) for -: 'list' and 'list' > > Because I am trying to subtract the "bots" list from the "tops" list. > In the example code I gave, bot and times were not lists but were a > 'numpy.ndarray' and a numpy.float64' object, respectfully, and I guess > the - operand can be used on them. > > How can I structure my data such that this can work? (For some reason > I have not had nearly this much confusion with plotting lines, just > bars). Che, just make a numpy array out of your two lists, and you'll be able to subtract one from the other. import numpy as np top = np.array(top) bot = np.array(bot) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |