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:
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
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
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..
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.
>
--
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
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
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
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
>
> 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
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
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
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
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
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()
>
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])
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.
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)?
probably problem with mod_wsgi
any solutions?
andrej
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
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
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
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
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
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()
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
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
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
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
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
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
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')
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
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
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
On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote:
>
>
>
>
Should be URL('static','mp1.png').
Anthony
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
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
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
39 matches
Mail list logo