svg plots don't scale with css; patch.

I’m using matplotlib to generate svg plots which I’m putting into an html document. I noticed the plots aren’t scaling the way I expect them to with css in an html page, so, a little yak-shaving later, I found a particular line in the source code that I think should change (or be changeable with an option).

Basically, the svg backend specifies a width and height in pixels. If I edit the svg file to set width and height to “100%”, the figure scales with css the way I expect.

Is there some way to do this without patching matplotlib (or editing every generated svg by hand)? I’m attaching the one-line patch to make the svg backend do what I want, but if someone wants the old behavior, perhaps there could be a configuration option in matplotlib.rcParams?

Vadim

svg_patch (505 Bytes)

···


A: Because it messes up the order in which people normally read text.

Q: Why is top-posting such a bad thing?

A: Top-posting.

Q: What is the most annoying thing in e-mail?