From: <gre...@gm...> - 2006-08-03 18:26:03
|
Hi Fine Matplotlib folks, I'm getting this error message and I can figure it out: Traceback (most recent call last): ... File "C:\automated tasks\GMVIEW-DEV\chart_gen.debug.py", line 26, in ? p1 =3D figure.gca().barh(ind, ddata['value'], width, color=3D'r') File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 2499, in ba= rh bottom =3D y - height/2. ValueError: frames are not aligned Here is the relevant code: <code> from __future__ import division import os,sys import datetime import tempfile import matplotlib matplotlib.use('Agg') # force the antigrain backend from matplotlib.dates import YearLocator, MonthLocator, WeekdayLocator, DateFormatter, date2num from matplotlib import rc from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.figure import Figure from matplotlib.cbook import iterable import matplotlib.numerix as nx ddata=3D{'label': ['REP1', 'REP2', 'REP3', 'REP4', 'REP5'], 'type': 'bar_sideways', 'value': ['23.00', '1381.56', '4606.69', '259.00', '50.00'], 'money_format': '1', 'title': 'Sales from 2006-08-01 to 2006-08-02'} height,width=3D3,4 figure =3D Figure(figsize=3D(width,height)) ax =3D figure.add_axes([0.2, 0.3, 0.7, 0.6]) from Numeric import arange #makes arrays N=3Dlen(ddata['value']) ind =3D arange(N) # the x locations for the groups width=3D(figure.get_size_inches()[0]/len(ddata['value'])) width_gap=3D(.3*width) width=3Dwidth-width_gap # the width of the bars #OFFENDING LINE p1 =3D figure.gca().barh(ind, ddata['value'], width, color=3D'r') figure.gca().set_ylabel('$Amount') if title: figure.gca().set_title('title', bbox=3D{'facecolor':'0.8', 'pad':5}) locs =3D figure.gca().set_xticks(ind+width_gap) labels =3D figure.gca().set_xticklabels(ddata['label']) figure.gca().set_xlim(-width,len(ind)) #try to autoscale here y_height=3Dmax(ddata['value'])+.2*max(ddata['value']) y_increment=3Dround(y_height/5,-1) figure.gca().set_yticks(arange(0,y_height,y_increment)) canvas =3D FigureCanvasAgg(figure) </code> any help is greatly appriciated! --=20 Gregory Pi=F1ero Chief Innovation Officer Blended Technologies (www.blendedtechnologies.com) |