nschloe / tikzplotlib

:bar_chart: Save matplotlib figures as TikZ/PGFplots for smooth integration into LaTeX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

matplotlib Linestyle 'None' does not get transformed

FrederikLauber opened this issue · comments

Hello,

trying this:

import tikzplotlib
import numpy
from matplotlib.figure import Figure
fig = Figure((5,5))
ax = fig.add_subplot(111)
t = numpy.asarray([1,2,3,4])
ax.errorbar(t, t, yerr=t)
tikzplotlib.save("test.tikz", fig)

Gives:

/tikzplotlib/_path.py in mpl_linestyle2pgfplots_linestyle(data, line_style, line)
    370             return None
    371 
--> 372         if len(line_style[1]) == 2:
    373             return (
    374                 "dash pattern="

TypeError: object of type 'NoneType' has no len()

I also tried changing the linestyle manually, the result stays the same.
I guess this is a bug or am I just stupid?

Which version of matplotlib are you using?
For me, your example works well with 3.2.2 but fails with 3.3.0.

Btw: this error look similar to the ones I encountered during the check of my latest pull request.

Fixed now.