|
From: Victor H. <vic...@ya...> - 2011-06-14 09:08:36
|
Goyo, Aha, so I can call .set_facecolor() on the Patch objects, and then force the graph to re-draw(). I've tested it - it works when I do savefig(). And if I'm running it interactive, I just run matplotlib.draw() after modifying the patch list. I suppose I can combine that technique with the calculation tip from Ben to colour-code the different region. I could run a for-loop over the Patch list, and do multiple if's - however, wondering if there's a way to do it with a list-comprehension? Thanks for the tips, guys =). Cheers, Victor On Fri, Feb 25, 2011 at 10:02, Goyo <goy...@gm...> wrote: > 2011/2/22 Benjamin Root <ben...@ou...>: > > > > Admittedly, this isn't using matplotlib's hist() function because it only > > allows for one color per dataset. However, you can use numpy's histogram > > function to get the bins and counts yourself, and then use bar() to make > the > > bars. bar() will allow you to color the bars individually. > > Pylab hist() returns a list of patches so you can also change their > properties. > > Goyo > |