Good advice about using forms to capture the plot parameters - be aware 
that you do not need to save anything to disk (unless you want/need to). 
 There's an example here of creating one and returning it directly via the 
response:

http://wiki.scipy.org/Cookbook/Matplotlib/Django


On Tuesday, 9 July 2013 16:58:45 UTC+2, John wrote:
>
>  On 09/07/13 15:40, amanjot kaur wrote:
>  
>
>
>>
>> There are many python plotting libraries. I usually use matplotlib 
>> because my plots tend to be quite technical.
>>
>  
> I also tried to use matplotlib but I think it is filereadable but my 
> requirements are to add values from front end and then with one click graph 
> will be ceated on these values.
>
>
> ...so you need to call matplotlib functions from the view function that 
> handles whatever form you have designed. If you want to plot onto an image 
> file (rather than embed canvas commands into an html response, for example) 
> then something like this might work:
>
> def my_view_function(request):
>     1. Create a plot using matplotlib from the form parameters.
>     2. Save the plot in /path/to/static/plots/<uuid>.png (depends where 
> you are serving static images from). I use uuid for things like this as I 
> know it will be unique and it doesn't have to be user friendly.
>     3. Prepare the html response which includes the graphic plot <img src="
> http://url/to/static/plots/<uuid>.png">.
>     4. Return the html response.
>
> If I was doing this, I would template the html part and also use the 
> settings variables for static file location/URL rather than hard-coding the 
> paths and URLs. I would also run some periodic background clean up function 
> to get rid of old plots otherwise they will steadily use more disk space.
>
> Hope that helps. Let the list know if it works!
>
> John
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to