matplotlib to TikZ converter

Hi all,

matplotlib to TikZ conversion example

development for a translator from matplotlib to the TikZ-based pgfplots has started at

https://github.com/nschloe/matplotlib2tikz

As of now, the script is still rather simplistic, but can already deal with line plots, images, subplots, and color bars. Adding new functionality should not be overly complicated.

Compared to translating MATLAB® figures to TikZ (see matlab2tikz, starting off with matplotlib2tikz was a lot easier. The documentation is fantastic, and whenever there's something unclear there are the incredibly helpful mailing lists, as well as the open source code to look at.

If you'd like to chime with the development -- now's the perfect time! The script is a mere 350 lines long, and the main author doesn't know what he's doing in Python and Git, so there'll be no ranting about bad code. :)

Cheers!
Nico

Tags: 

Comments

Thank you Nico for starting this project. I have been thinking about creating a TikZ backend for Matplotlib for some time, but now it seems that I don't have to :) I better focus on my svg to tikz converter

At first I was a bit confused about why you didn't write a proper Matplotlib backend, but it make sense after reading the thread on the matplotlib mailing list.

Hi,

Thanks for doing this, it seems really interesting.
I have a bunch of python/matplotlib scripts and I would like to see how a tikz output would look like.

How do you actually use your script ? I tried adding a "matplotlib2tikz()" line, but the resulting output only contains \begin{tikzpicture}

\end{tikzpicture}

Thanks

Thank you for this really useful script!
Have you thought about implemting a legend()?

I think it was yesterday or the day before that I pushed some basic support for legends into matplotlib2tikz.

Thanks a lot for making your work publicly available.

I just came across it after hours and hours of fiddling with the text.usetex feature of matplotlib and not getting desired results (same font in thesis text and figures). With matploltlib2tikz this does not only work - it even makes it super simple!

Again: Thanks so much, you saved my day!

Add new comment

Addthis