[web2py] Re: matplotlib passing parameters from the view

2016-05-06 Thread Niphlod
if your generated url is /a/c/f/*graf_comp_gior*?var1=a&var2=b I assure you that those will be passed. as for the graphing library, I highly suggest to switch to a javascript based solution rather than a python one for any web site. On Friday, May 6, 2016 at 8:50:21 AM UTC+2, Paolo Amboni wrote:

[web2py] Re: matplotlib passing parameters from the view

2016-05-05 Thread Paolo Amboni
Same problem! the args and var are not passed to the receiving function in this specific case. (I tried both args and vars alone first). With session all works fine. I find very complex the way web2py handle matplotlib plots. Is there other plotting library that better integrate in web2py framewo

[web2py] Re: matplotlib passing parameters from the view

2016-05-05 Thread Niphlod
there's a problem in your syntax. it's usually URL('blabla', args=[], vars=dict()) while your code reports args=[..., dict=()] On Thursday, May 5, 2016 at 9:53:44 AM UTC+2, Paolo Amboni wrote: > > I stored the id in a session variable and it works fine!! > But why the URL helper didn't send the

[web2py] Re: matplotlib passing parameters from the view

2016-05-05 Thread Paolo Amboni
I stored the id in a session variable and it works fine!! But why the URL helper didn't send the args to the function? Il giorno giovedì 5 maggio 2016 09:36:32 UTC+2, Paolo Amboni ha scritto: > > I'm trying to build a single function (in a controller) that generate > different matplotlib graph..

[web2py] Re: Matplotlib

2015-10-05 Thread Laurent Lc
thank you Le vendredi 2 octobre 2015 10:59:39 UTC+2, pa...@cancamusa.net a écrit : > > You can also use this: > > http://mpld3.github.io/index.html > > If I understand correctly, once you provide some static libraries, you can > serve your plots as plain html, or even json, in your views. > --

[web2py] Re: Matplotlib

2015-10-02 Thread pang
You can also use this: http://mpld3.github.io/index.html If I understand correctly, once you provide some static libraries, you can serve your plots as plain html, or even json, in your views. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py

[web2py] Re: Matplotlib

2015-10-01 Thread Laurent Lc
Sorry i found just put the function draw in a model and add write in the controller: def mychart(): response.headers['Content-Type']='image/png' return draw() Le jeudi 1 octobre 2015 10:36:27 UTC+2, Laurent Lc a écrit : > > I found something : > > In a controller (the import is done in a

[web2py] Re: Matplotlib

2015-10-01 Thread Laurent Lc
I found something : In a controller (the import is done in a model) : def mychart(): return dict(a=IMG(_src=URL('draw'+'.png'))) def draw(): x = [datetime.date(2014, 1, 29), datetime.date(2014, 4, 15), datetime.date(2014, 3, 29)] y = [2, 4, 1] fig, ax = plt.subplots() ax.pl

[web2py] Re: matplotlib inserting my data

2013-05-12 Thread new2web2py
many many thanks Alan, youre answer is 100% percent correct and works perfectly. Really appreciate you taking the time to help. On Sunday, May 12, 2013 3:23:24 PM UTC+1, new2web2py wrote: > > Hello all, im new to python and web2py. i have been trying to get > matplotlib working in web2py and fo

[web2py] Re: matplotlib inserting my data

2013-05-12 Thread Alan Etkin
> > Hello all, im new to python and web2py. i have been trying to get > matplotlib working in web2py and followed the example at > http://www.web2pyslices.com/slice/show/1357/matplotlib-howto this is > working but i dont know how to plug my data into it. One option is to make the following be

[web2py] Re: matplotlib + web2py question

2012-05-02 Thread Larry Wapnitsky
Can this be done without storing the image if it's only needed the one time? On Wednesday, April 4, 2012 4:45:50 PM UTC-4, dancer` wrote: > > Thank you very much. > > One more thing - if I understand correctly this allows me to keep my data > buffer clean and not worry about overwriting plots. I

[web2py] Re: matplotlib + web2py question

2012-04-04 Thread Massimo Di Pierro
The code I posted will create a temp file, them move it to uploads (not static) using db.table.file.store(...) The store function will create a new unique and secure filename in upoads. If you have no future plans to add access control to these files, than you can put them in static. In that ca

[web2py] Re: matplotlib + web2py question

2012-04-04 Thread dancer`
Thank you very much. One more thing - if I understand correctly this allows me to keep my data buffer clean and not worry about overwriting plots. Is it possible to use a date/time unique naming format to automatically name the image files and store them, say, in the static folder? Or somewher

[web2py] Re: matplotlib + web2py question

2012-04-04 Thread Massimo Di Pierro
Makes perfect sense. When you use matplotlib you can do: You can store the image in temp file: import tempfile f = tempfile.NamedTemporaryFile() canvas = FigureCanvas(figure) canvas.print_png(f) filename = f.name f.close() then move it to the db in a field called for e

Re: SOLVED Re: [web2py] Re: matplotlib plugin

2012-01-18 Thread Massimo Di Pierro
Not sure I understand the question. You need two functions. One returns the image. One returns the view that embeds the image. On Jan 18, 3:24 pm, andrej burja wrote: > thank you > > this is working example > > controller: > import os, tempfile > os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp() >

SOLVED Re: [web2py] Re: matplotlib plugin

2012-01-18 Thread andrej burja
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])

Re: [web2py] Re: matplotlib plugin

2012-01-16 Thread Mariano Reingart
You can send the image directly to the view, for an example see: http://code.google.com/p/rad2py/source/browse/psp2py/modules/draws.py http://code.google.com/p/rad2py/source/browse/psp2py/controllers/reports.py#243 Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.

[web2py] Re: matplotlib plugin

2012-01-16 Thread andrej burja
i've installed the latest verson of matplotlib (from source, also libpng and freetype) now matplotlib is working but using MATLAB a lot, i have one question: is it possible to usematplotlib.pyplot instead of matplotlib api (matplotlib.figure) and not saving the file (sendign directly to view)?

[web2py] Re: matplotlib plugin

2011-12-15 Thread andrej burja
probably problem with mod_wsgi any solutions? andrej

[web2py] Re: matplotlib plugin

2011-12-14 Thread andrej burja
the line #os.environ['MPLCONfigureDIR'] = tempfile.mkdtemp() should be os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp() but now there is this error: * Traceback (most recent call last): File "/home/www-data/web2py/gluon/restricted.py", line 194, in restricted e

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
It works, thanks :) Next step is to upgrade the HTML code because this just looks like text. regards, Richard Op 8-9-2011 23:30, Anthony schreef: No, you need to add return dict() to the end of you index() function in your controller -- not to the view file. Anthony On Thursday, September 8

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Vézina
haha I wasn't understand why he was putting that there and I didn't realise it was a mistake ;-) Richard On Thu, Sep 8, 2011 at 5:30 PM, Anthony wrote: > No, you need to add return dict() to the end of you index() function in > your controller -- not to the view file. > > Anthony > > > On Thur

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Anthony
No, you need to add return dict() to the end of you index() function in your controller -- not to the view file. Anthony On Thursday, September 8, 2011 4:45:51 PM UTC-4, Richard wrote: > > The view is not executed. Adding return dict() doesn't have effect. Even > this dict() does not lead

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Vézina
The view need a controller to return a dict variable at least one to be executed I think... So maybe your controller has noting to do so you just have created a view with the code that you want to be executed (the code that you showed us)... Try returning a empty var from your controller if you h

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
The view is not executed. Adding return dict() doesn't have effect. Even this dict() does not lead to an error. {{extend 'layout.html'}} {{if 'message' in globals():}} Outfile from Matplotlib return dict() Op 8-9-2011 22:24, Anthony schreef: Have you shown us your entire index()

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
Richard, To be sure about the comment I made the following view, which had the same None result {{extend 'layout.html'}} Outfile from Matplotlib regards, Richard Op 8-9-2011 22:11, Richard Vézina schreef: Not sure but I think there is a mistake in your view that should be ok without

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Anthony
Have you shown us your entire index() function? If so, your view file isn't getting called at all because your index function is not returning a dictionary. Instead, web2py is simply returning whatever your function returns, which is probably None if the last line is a call to plt.savefig(). Ad

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Vézina
Not sure but I think there is a mistake in your view that should be ok without it The # not work to comment a line in the view so try remove your line completly or you may try with html commenting caracter... But those don't prevent web2py to interpret the {{=}}, so what I usually do si to remove

Re: [web2py] Re: matplotlib output

2011-09-08 Thread Richard Dijkstra
The mp1.png file is in the static directory of my application The following views/default/index only gives an empty page with "None" in the top left corner. {{left_sidebar_enabled=right_sidebar_enabled=False}} {{extend 'layout.html'}} {{if 'message' in globals():}} {{=message}} #Events

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
Looking closer an output window appears and the console gives errors on the sequence of calling matplotlib.backends: I'll check first. Op 7 sep 2011, om 22:43 heeft Anthony het volgende geschreven: > But does > plt.savefig(os.path.join(request.folder,'static','mp1.png'),format='png') > resu

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
Yes it does :) Op 7 sep 2011, om 22:43 heeft Anthony het volgende geschreven: > But does > plt.savefig(os.path.join(request.folder,'static','mp1.png'),format='png') > result in a file being saved in c:\web2py\applications\your_app\static\? > > > On Wednesday, September 7, 2011 4:38:13 PM UTC

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Anthony
But does plt.savefig(os.path.join(request.folder,'static','mp1.png'),format='png') result in a file being saved in c:\web2py\applications\your_app\static\? On Wednesday, September 7, 2011 4:38:13 PM UTC-4, Richard wrote: > > Anthony, > > plt.savefig('c:\web2py\outputfile.png',format='png')

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
Anthony, plt.savefig('c:\web2py\outputfile.png',format='png') does me give an accessable png-file Op 7-9-2011 22:20, Anthony schreef: Have you confirmed that the file is actually getting saved in the expected location? Are you able to run the matplotlib code and save the file outside of w

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Anthony
Have you confirmed that the file is actually getting saved in the expected location? Are you able to run the matplotlib code and save the file outside of web2py? On Wednesday, September 7, 2011 4:05:08 PM UTC-4, Richard wrote: > > Only adding the .png extention is not sufficient. > > outputfil

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
Only adding the .png extention is not sufficient. outputfile = os.path.join(request.folder,'static','mp1.png') plt.savefig(outputfile,format='png') Outfile from Matplotlib Besides this issue; is using a temporarily file a mature solution or is streaming preferrable? Richard Op 7-9-201

[web2py] Re: matplotlib output

2011-09-07 Thread Anthony
On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote: > > > > Should be URL('static','mp1.png'). Anthony

[web2py] Re: matplotlib image map using web2py

2011-06-29 Thread G
To follow up, if I were to go about this in a brute force manner, by simply saving the dynamically generated figure to a randomly generated file and then passing that file to an AREA MAP / IMG tag, where in the web2py directory structure would be the recommended place to do so? I suppose using the

[web2py] Re: matplotlib vs mod_wsgi... again

2011-06-01 Thread Manuele Pesenti
On 01/06/2011 08:44, Manuele Pesenti wrote: Ok, here it is the steps I followed... I forgot to add that I have edited the model plugin_matplotlib in this way applying the solution suggested in this old post https://groups.google.com/forum/#!topic/modwsgi/97bnQk9ojtY import os, tempfile, ra

[web2py] Re: matplotlib vs mod_wsgi... again

2011-05-31 Thread Manuele Pesenti
Ok, here it is the steps I followed... on a new web2py instance version 1.95.1 (2011-04-25 15:04:14) installed under mod_wsgi 3.3 and Apache/2.2.3 and python 2.6 I have downloaded and installed matplotlib-1.0.0 than under the welcome application I have installed plugin_matplotlib but visiting