3

I've just started transitioning over from MATLAB to python and I'm moving from matlab2tikz to tikzplotlib (same author).

The tikzplotlib script doesn't appear to be defining the the custom colours it is using, so although a tikz plot might be correctly created:

...
...
\addplot [color0]
coordinates {
(0, 1)
(1, 2)
};

color0 isn't being defined. Is this just a fundamental problem with the tikzplotlib code (this seems unlikely!)?

EDIT: color0 IS defined the first time i run tikzplotlib - I then have to 'kill the current process' and restart the console (I'm using Spyder IDE) to successfully run tikzplotlib again.

I get the impression that I am making some fundamental mistake that could well have nothing to do with tikzplotlib.

Nico Schlömer
  • 53,797
  • 27
  • 201
  • 249
casimp
  • 105
  • 1
  • 9
  • 1
    Have you tried using the PGF/Tikz backend instead? http://matplotlib.org/users/pgf.html#pgf-tutorial It should be as simple as `matplotlib.use('pgf')` before importing `pyplot`. – Joe Kington Jan 13 '14 at 21:32
  • That looks like a really interesting alternative! I see that TikZ is built on top of PGF - I'm not sure what the implications of working with PGF rather than tikz will be, but I'll certainly try it out! – casimp Jan 13 '14 at 21:45
  • `matplotlib` also generates proper vector graphics (eps, pdf) which also embed nicely in latex (which I assume is your target if you are using tikz) – tacaswell Jan 14 '14 at 14:56
  • 1
    If the plot you `show()` with matplotlib isn't converted to the exact same thing by [matplotlib2tikz](https://github.com/nschloe/matplotlib2tikz), it's a matplotlib2tikz issue. Things have improved significantly recently, so you might want to check it out again. If it still doesn't work [filing an issue](https://github.com/nschloe/matplotlib2tikz/issues) will do. – Nico Schlömer Mar 10 '16 at 07:53

0 Answers0