thank you

this is working example

controller:
import os, tempfile
os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp()
import cStringIO
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np

def draw():    
    x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])
    y = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 
4.82, 5.68])
    matplotlib.pyplot.clf()
    plt.plot(x, y,'ro-')
    plt.ylabel('label y')
    
    body = cStringIO.StringIO()
    plt.savefig(body) 
    return body.getvalue()

def image():
    return dict(a=IMG(_src=URL('draw'+'.png')))

view:
{{extend 'layout.html'}}
<h1>This is the graf/image.html template</h1>
{{=a}}

just one question: how can i omit function slika? how can i include 'return 
dict(...' in funtion draw()?

andrej

Reply via email to