[SciPy-User] IPython inline plots of stacked bars graphs

Chris Withers chris at simplistix.co.uk
Sat Aug 20 19:12:22 EDT 2011


Hi All,

If I do the following in an IPython 0.11 Qt shell:

import matplotlib.pyplot as plt
menMeans   = (20, 35, 30, 35, 27)
womenMeans = (25, 32, 34, 20, 25)
plt.bar(ind, menMeans, color='r')
plt.bar(ind, womenMeans, color='y', bottom=menMeans)

I get, as I'd expect, a stacked bar graph.

However, if I do:

plt.bar(ind, menMeans, color='r')

...hit enter, and then do:

plt.bar(ind, womenMeans, color='y', bottom=menMeans)

...I get two separate plots.

How can I add to an existing inline plot?

Also, and I guess this might be more of a matplotlib question, how do I 
"reach inside" an existing plot to, for example, adjust the width of the 
bars used?

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk



More information about the SciPy-User mailing list