Hi all,

Has any of you had any luck with creating stacked histograms using 
matplotlib? It seems to work but I have no idea how to label (or add the 
legend) or choose the colors of the stacks. Below is a sample code for 
creating a stacked histogram. Can anyone help please? Unlike the "bar()" 
function, hist() doesn't seem to have the color/colors parameter.

#!/usr/bin/python

import sys
import matplotlib.pyplot as pyplot
import numpy as numpy

page_numbers_one = (100,100,500,600,800)
page_numbers_two = (100,100,500,600,800,100,100,100,100,100)
page_numbers_three = (900,100,500,600,800,500)

pyplot.hist((page_numbers_one,page_numbers_two,page_numbers_three),histtype='barstacked',bins=5)

pyplot.show()

best,
amit shrestha

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to