I use django and matplotlib quite a bit at my work. I can probably help you. It is pretty easy to set up with a few basics.

I am actually thinking of contributing to the documentation on this.

Unfortunately, my code is at work, so I can give the best concrete examples right now. However, basically, I import StringIO and output the the results from from matplotlib to StringIO. I then convert the StringIO to a base64 string, and then pass this string to my template. I can create dynamic images this way.

Sorry I am so vague, but if you email me back, I promise to follow up.

P.

On 3/17/14 6:56 PM, Aarthi Reddy wrote:
Hi,

I am very new to python, so sorry if the question is basic.

I am also very new to Django. I followed the instructions on https://docs.djangoproject.com/en/1.6/intro/tutorial01/ through tutorial 4 to set up a sample webpage and play around with it.

I would like to generate plots via matplotlib and display the png files on the webpage. However, I am not sure where to start. I looked at the cookbook here:
http://wiki.scipy.org/Cookbook/Matplotlib/Django

but I was not sure which urls.py the recommended change needs to be made to and where charts.py should go.

Does anyone know how to embed an image in a webpage. Is there a step by step tutorial I could follow. I found some tutorials but they were dated and do not work with the latest versions. I am using for python 2.7.5, matplotlib u'1.4.x' and django 1.6.2.

Thanks,
Aarthi




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech


_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to