TikZ/PGF backend #319

Closed
ddale opened this Issue Jun 20, 2011 · 3 comments

Projects

None yet

4 participants

@ddale

Original report at SourceForge, opened Thu Aug 20 12:42:48 2009

It would be nice to render plots directly to TikZ for embedding as native graphics in (La/Con)TeX(t). There are random, small projects across the web that I've found that offer provisional translation from EPS or SVG to TikZ, but nothing really complete. In fact, given a simple test case

http://matplotlib.sourceforge.net/examples/api/histogram_demo.html

that matplotlib rendered in SVG or EPS, each one failed in one way or another. The most promising seems to be an inkscape plugin,

http://code.google.com/p/inkscape2tikz/

but I'd rather have something that I can script, or better yet, have matplotlib output plots directly into TikZ code.

SourceForge Comments

On Sat May 8 06:27:11 2010, None wrote:

I've started a matplotlib2tikz converter some time ago at GitHub, as a proper backend is not really suitable for the task: Backends only have access to basic information like "draw a line from a to b" instead of "draw x-tick at 0.4", which is what TikZ/Pgfplots needs. Anyway, most of this stuff can really be fetched from all those get_* methods.
I've been working this morning on it a bit, and right now the converter should be in okay shape for simple plots, some colored graphs with labels, legends, this kind of stuff.

Just poke me on GitHub or so if you're still motivated. :)

Cheers,
Nico

@mdboom
Matplotlib Developers member

The Github repository mentioned in this bug appears to have moved to:

https://github.com/nschloe/matplotlib2tikz

I will check-in with the author over there.

@aeberspaecher

There is https://github.com/pwuertz/matplotlib-backend-pgf/
This might resolve this issue.

@pwuertz

The pgf backend should indeed resolve the issue, except if you expected the output to be human readable or editable.

This is probably what matplotlib2tikz is supposed to do, but as Nico said, this cannot be realized as a backend. Also, since matplotlib2tikz must interpret and recreate the whole figure from matplotlib it will never exactly reproduce the result you'll see with a backend, which is why I started the pgf-backend.

@pwuertz pwuertz closed this Sep 18, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment