[Matplotlib-users] Render canvas object (figure) to html files(templates) in Django.
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Building 1.2.0 with Python 3.3 on Windows (MinGW)
`python3 setup.py build` fails with this error: ... running build_ext building 'matplotlib.ft2font' extension creating build\temp.win32-3.3 creating build\temp.win32-3.3\Release creating build\temp.win32-3.3\Release\src creating build\temp.win32-3.3\Release\cxx C:\MinGW\bin\gcc.exe -mdll -O -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 -Iwin32_static\include -Ic:\python33\lib\site-packages\numpy\core\include -I. -Iwin32_static\include\freetype2 -Ic:\python33\lib\site-packages\numpy\core\include\freetype2 -I.\freetype2 -Ic:\python33\include -Ic:\python33\include -c src/ft2font.cpp -o build\temp.win32-3.3\Release\src\ft2font.o In file included from src/ft2font.cpp:3:0: src/ft2font.h:16:22: fatal error: ft2build.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1 It seems like it looks for freetype header file. How to supply this? Thanks -- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Building 1.2.0 with Python 3.3 on Windows (MinGW)
Some more info I think I should have posted: BUILDING MATPLOTLIB matplotlib: 1.2.0 python: 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] platform: win32 Windows version: sys.getwindowsversion(major=5, minor=1, build=2600, platform=2, service_pack='Service Pack 3') REQUIRED DEPENDENCIES numpy: 1.7.0rc1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of 'win32_static\include', '.', * 'win32_static\include\freetype2', '.\freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * 'win32_static\include', '.' Tkinter: no * Tkinter present, but header files are not found. * You may need to install development packages. Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Mac OS X native: no Qt: no Qt4: Qt: 4.8.4, PyQt4: 4.9.6 PySide: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES dateutil: matplotlib will provide pytz: matplotlib will provide six: matplotlib will provide OPTIONAL USETEX DEPENDENCIES dvipng: 1.12 ghostscript: 9.06 latex: MiKTeX 2.9 [Edit setup.cfg to suppress the above messages] Friday, January 11, 2013, 2:03:51 PM, you wrote: > `python3 setup.py build` fails with this error: > > ... > running build_ext > building 'matplotlib.ft2font' extension > creating build\temp.win32-3.3 > creating build\temp.win32-3.3\Release > creating build\temp.win32-3.3\Release\src > creating build\temp.win32-3.3\Release\cxx > C:\MinGW\bin\gcc.exe -mdll -O -Wall > -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 > -DPYCXX_PYTHON_2TO3=1 -Iwin32_static\include > -Ic:\python33\lib\site-packages\numpy\core\include -I. > -Iwin32_static\include\freetype2 > -Ic:\python33\lib\site-packages\numpy\core\include\freetype2 > -I.\freetype2 -Ic:\python33\include -Ic:\python33\include -c > src/ft2font.cpp -o build\temp.win32-3.3\Release\src\ft2font.o > In file included from src/ft2font.cpp:3:0: > src/ft2font.h:16:22: fatal error: ft2build.h: No such file or directory > compilation terminated. > error: command 'gcc' failed with exit status 1 > > It seems like it looks for freetype header file. > How to supply this? -- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Building 1.2.0 with Python 3.3 on Windows (MinGW)
I found this: https://github.com/cournape/matplotlib-dependencies but what should I do with it? Should I try to compile or put it in some folder? How to instruct matplotlib to use those? site.cfg template doesn't have any entry for each of above packages. -- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
