Hi John,
Ok- that makes sense.
While on the subject of bar charts, can you tell me what I'm doing wrong here?
def chart(request):
from PIL import Image as PILImage
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from StringIO import StringIO
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
from pylab import *
N = 7
menMeans = (20, 35, 30, 35, 27, 21, 60)
ind = arange(N) # the x locations for the groups
width = 0.35 # the width of the bars
p1 = bar(ind, menMeans, width, color='b')
#ylabel('Time')
title('Time In Minutes - Last 7 Days')
xticks(ind+width, ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', '*') )
canvas.draw()
size = canvas.get_renderer().get_canvas_width_height()
buf=canvas.tostring_rgb()
im=PILImage.fromstring('RGB', size, buf, 'raw', 'RGB', 0, 1)
imdata=StringIO() #ERROR LINE - 'module' object is not callable
im.save(imdata, format='PNG')
response = HttpResponse(imdata.getvalue(), mimetype='image/png')
return response
I keep getting an error saying 'module' object is not callable
pointing to line 45 [imdata=StringIO()]
This method worked fine for a pie chart.
Thanks!
Erik
On 6/4/07, John Hunter <[EMAIL PROTECTED]> wrote:
> On 6/4/07, Erik Wickstrom <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to create a 3d bar chart like the one attached for use in a
> > django site. I have no idea where to start. Is it even possible with
> > matplotlib?
>
> Not really, and this is by design I've intentionally avoided all of
> these power point style features which mostly detract from the
> information in the graph. In a bar chart, once you've displayed the
> height of the bar, there is no additional information to be had by
> adding a gradient to it, or by making it look 3D. Those extra special
> effects confuse the information that the graph actually contains. In
> many cases, I think that's why people want to add them: if the data
> are boring or don't say what you want, why not spice it up with some
> sexy graph features so people won't look so hard at the data?
>
> The shadow on the pie chart was a nod to those who want "chart junk"
> as Tufte calls these effects, but it was probably a mistake.
>
> http://www.edwardtufte.com/tufte
>
> I might accept a patch to add features like this if they remained off
> by default, but I probably won't be adding it myself.
>
> JDH
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users