Hi  all,

I am using matplotlib with Django.
I want to display figures processed in Django apps by matplotlib in browser
using html5.

I tried:

*def plot_file(request):*
*    import matplotlib.cbook as cbook*
*    fig = figure()*
*    fname = cbook.get_sample_data('msft.csv', asfileobj=False)*
*    plotfile(fname, (0,1,2,3))*
*
*
*    canvas = FigureCanvas(fig)*
*    response = HttpResponse(content_type="image/png")*
*    canvas.print_png(response)*
*    fig.clear()*
*    return response*

This response takes whole page and displays figure.
I have other contents as well to display along with figure.

How can I send it as a canvas object or something else(I am unaware of) in
order to have print logic in html file(django templates)
in order to position figure as my requirement:

I thought of something like this, but not sure:

*def plot_file(request):*
*    ---------------*
*    ---------------*
*    return render_to_response('template.html',{*
*        'canvas':canvas,*
*    },  *
*    context_instance=RequestContext(request),*
*    )   *
-------------------------------------------------------------------------------------------------------------------------
Please make me inform, If I need to provide more context.

Regards,
Navid Shaikh.
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to