Dear developers, I found a very easy way of creating a horizontal bar chart, which can also be easily animated. I wondered if this could be useful for anyone else, so here is the code:
def hbarplot(a,b): y1 = 0 y2 = -b[0] P = polygon([[0,y1],[0,y2],[a[0],y2],[a[0],y1]]) for i in srange(1,len(a)): y1 = y2 y2 = y2 - b[i] P += polygon([[0,y1],[0,y2],[a[i],y2],[a[i],y1]]) return P The first argument is a list of values for the horizontal bar lenghts and the second is a list of bar thicknesses. The plot will start at the top and stack the bars negatively to illustrate e.g. soil profiles, but this could be changed easily. Example animation: animate(hbarplot([i,6],[0.5,0.5]) for i in srange(5)).show() It took me 15 minutes to code this up, while it took me a lot longer to try out pylab's animations and bar charts before giving up on that. Cheers Stan --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---