stacked bar graphs not appearing correctly

hi all,

i am trying to make a simple stacked bar graphs (just two layers) and
am getting some strange results. i have the following code:

import numpy as np
import matplotlib.pyplot as plt
ind = np.arange(3)
width = 0.35
plt.bar(ind, [5128307, 4305252, 4817425], width, align='center', color='r')
plt.bar(ind, [5969352, 5011032, 5590754], width, align='center',
bottom=[5128307, 4305252, 4817425], color='k')

i want it to be so that the bar graphs with values [5128307, 4305252,
4817425] appear in red "below" the taller bar graphs with values
[5969352, 5011032, 5590754]. when i try to plot this, i get a very
strange y-axis, formatted on a 1e7 scales, and the values appear
wrong.

if i modify my plot to simply be:

ind = np.arange(3)
width = 0.35
plt.bar(ind, [5969352, 5011032, 5590754], width, align='center', color='k')

then the y-axis appears correctly, with ylim set to 6 million. how can
i get the graph to look just like this, except have the stacked
smaller bar graphs appear in red?

any help on this would be greatly appreciated.

thanks.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.bar

The second argument is the heights of the bars, not the top coordinate.

-JJ

ยทยทยท

On Sun, Sep 27, 2009 at 11:29 AM, per freem <perfreem@...287...> wrote:

hi all,

i am trying to make a simple stacked bar graphs (just two layers) and
am getting some strange results. i have the following code:

import numpy as np
import matplotlib.pyplot as plt
ind = np.arange(3)
width = 0.35
plt.bar(ind, [5128307, 4305252, 4817425], width, align='center', color='r')
plt.bar(ind, [5969352, 5011032, 5590754], width, align='center',
bottom=[5128307, 4305252, 4817425], color='k')

i want it to be so that the bar graphs with values [5128307, 4305252,
4817425] appear in red "below" the taller bar graphs with values
[5969352, 5011032, 5590754]. when i try to plot this, i get a very
strange y-axis, formatted on a 1e7 scales, and the values appear
wrong.

if i modify my plot to simply be:

ind = np.arange(3)
width = 0.35
plt.bar(ind, [5969352, 5011032, 5590754], width, align='center', color='k')

then the y-axis appears correctly, with ylim set to 6 million. how can
i get the graph to look just like this, except have the stacked
smaller bar graphs appear in red?

any help on this would be greatly appreciated.

thanks.

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options