[Flask] Save Matplot file in svg format
Scott Werner
scott.werner.vt at gmail.com
Tue Sep 8 14:15:18 CEST 2015
Next time provide your flask code that is not working. Here's an example of
returning a matplotlib graph as SVG format:
https://gist.github.com/wilsaj/862153. Since you want to save it to the
fileSystem, you will need to implement two routes, see
http://stackoverflow.com/questions/20107414/passing-a-matplotlib-figure-to-html-flask
.
On Tue, Sep 8, 2015 at 2:33 AM, Great Avenger Singh <arsh840 at gmail.com>
wrote:
> Hi,
>
> I am using matplotlib to generate graph and save them as a SVG format.
> A simple Python program like following does required work.
>
> <code>
>
> import matplotlib.pyplot as plt
> import numpy as np
>
> plt.figure(figsize=[6,6])
> x = np.arange(0,100,0.00001)
> y = x*np.sin(2*pi*x)
> plt.plot(y)
> plt.axis('off')
> plt.gca().set_position([0, 0, 1, 1])
> plt.savefig("test.svg")
>
> </code>
>
> But this is not working with Flask. I want to save file in fileSystem.
>
> --
>
> Thanks
> Arshpreet Singh
>
> I am Sikh boy, Learning by doing and Learning by teaching is my religion.
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Flask mailing list
> Flask at python.org
> https://mail.python.org/mailman/listinfo/flask
>
--
Scott Werner
scott.werner.vt at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20150908/fb786173/attachment.html>
More information about the Flask
mailing list