[Matplotlib-users] SVG figs

Hi,

Anyone is welcome to work on the SVG backend. I didn't realize that
John thought I was hard at work on improving it, when actually I've been
happily using it. Sorry for not communicating that... I'm not going to
have any time to work on it in the near future, so go nuts. I'm an
amateur, so there are plenty of bugs! :slight_smile:

There is an SVG backend already in matplotlib. It hasn't been
announced because it is in development by Jared Wahlstrand. Perhaps
Jared can give a status report on what needs to be done, and you might
want to help out. He might have a more recent copy in his development
tree than I do.

Here are the issues as I understand them:

  * image support

This is waiting on a save_image function in the Agg backend, so that we
can link to an external PNG file.

  * font support (freetype vs afm), use of font families /
    font_manager

Is this the issue of 'helvetica' versus 'sans serif'?

  * mathtext

I don't know where to begin here, but the implementation is going to
look a lot like the PS backend. It would be cool to embed MathML, but
good luck finding a viewer capable of reading it... :slight_smile:

  * some oddness when the user calls savefig with a high dpi?
    Shouldn't SVG ignore the dpi setting? That's what I did in
    backend_ps.

You're right, it shouldn't need to know the dpi. This is an artifact
from when I ported everything from the PS backend.

  * There also appears to be some problem in centering the figure?

I haven't experienced this.

I've been using it to export to inkscape to make figures for papers and
conference talks and haven't had any major problems. The code in 0.60
is the same as I've been using, with the exception of adding another
case to print_figure() to switch to the SVG backend when the filename
has a .svg extension.

It's not complicated code, so it should be easy to understand, but let
me know if you have any questions.

Cheers,

Jared

···

On Thu, 2004-07-08 at 16:16, John Hunter wrote:

So…

can we type

matplotlib.use(‘SVG’)

and start playing with it or what?

what about some examples?smiley-4.png

_
Hi,
Anyone is welcome to work on the SVG backend. I didn't realize that
John thought I was hard at work on improving it, when actually I've been
happily using it. Sorry for not communicating that... I'm not going to
have any time to work on it in the near future, so go nuts. I'm an
amateur, so there are plenty of bugs! :)
> There is an SVG backend already in matplotlib. It hasn't been
> announced because it is in development by Jared Wahlstrand. Perhaps
> Jared can give a status report on what needs to be done, and you might
> want to help out. He might have a more recent copy in his development
> tree than I do.
> > Here are the issues as I understand them:
> > * image support
This is waiting on a save_image function in the Agg backend, so that we
can link to an external PNG file.
> * font support (freetype vs afm), use of font families /
> font_manager
Is this the issue of 'helvetica' versus 'sans serif'?
> * mathtext
I don't know where to begin here, but the implementation is going to
look a lot like the PS backend. It would be cool to embed MathML, but
good luck finding a viewer capable of reading it... :)
> * some oddness when the user calls savefig with a high dpi?
> Shouldn't SVG ignore the dpi setting? That's what I did in
> backend_ps.
You're right, it shouldn't need to know the dpi. This is an artifact
from when I ported everything from the PS backend.
> * There also appears to be some problem in centering the figure?
I haven't experienced this.
I've been using it to export to inkscape to make figures for papers and
conference talks and haven't had any major problems. The code in 0.60
is the same as I've been using, with the exception of adding another
case to print_figure() to switch to the SVG backend when the filename
has a .svg extension.
It's not complicated code, so it should be easy to understand, but let
me know if you have any questions.
Cheers,
Jared_

fiocruz4.jpg
Flávio Codeço Coelho, PhD

Programa de Computação Científica

Fundação Oswaldo Cruz

Rio de Janeiro – Brasil

···

On Thu, 2004-07-08 at 21:51, Jared Wahlstrand wrote:

On Thu, 2004-07-08 at 16:16, John Hunter wrote:


For a start, you can replace 'PS' with 'SVG' in pstest.py in the
examples. Otherwise, any of the examples that don't have mathtext or
images should work. Just add

import matplotlib
matplotlib.use('SVG')

at the beginning and then

savefig('myfilename')

at the end.

jared

···

On Fri, 2004-07-09 at 06:59, Flavio Codeco Coelho wrote:

So...

can we type

matplotlib.use('SVG')

and start playing with it or what?

what about some examples?:wink:

Flávio Codeço Coelho,
PhD

Programa de Computação
Científica

Fundação Oswaldo Cruz

Rio de Janeiro --
Brasil

______________________________________________________________________