heya,
I'm trying to use Matplotlib to generate a histogram of some measurements:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as pyplot
...
fig = pyplot.figure()
ax = fig.add_subplot(1,1,1,)
n, bins, patches = ax.hist(measurements, bins=50, range=(graph_minimum,
graph_maximum)
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 ca
bins much easier. It's strange that
colour-coding bars isn't a feature of hist().
I guess I'll have to look at doing all the hist setup/calculations by hand.
Ah well.
Thanks,
Victor
On Wed, Feb 23, 2011 at 03:12, Benjamin Root wrote:
>
>
> On Tue, Feb 15, 2011 at 11:07 PM,
heya,
Is there an easy way to colour-code a Matplotlib histogram with a single set
of data?
So for example, you'd have a bell-shaped histogram, and the middle 50% might
be green, the regions 20% to the left and right of that might be yellow, and
the 5% either side beyond that could be red.
I cou