views:

249

answers:

1

I am trying to dymamically render an SVG image from matplotlib and insert it into the HTML document.

I am using Cairo.SVG as the matplotlib backend.

Now whenever I try to insert it into the

<img src="/url_to_graph" /> 
//or 
<object data="/url_to_graph" />

I either get nothing or the "Missing Plugins" error from Firefox.

FYI I am using Firefox. Also any other examples of SVG images I find on the web, work just fine - and require no plugin.

Does matplotlib render the SVG images in some special format I don't know about?

+1  A: 

Have you tried <object type="image/svg+xml" data="/url_to_graph"></object>?

<img src="/url_to_graph"/> should work.

Are you able to see the svg file with other applications?

My guess is that the file is correctly generated, but the webserver is sending them with an incorrect mime-type.

voyager
Yap, I did not send the correct mimetype from django...
drozzy