tikzplotlib
tikzplotlib copied to clipboard
Adding a legend causes AttributeError
import matplotlib.pyplot as plt import numpy as np
plt.style.use("ggplot")
t = np.arange(0.0, 2.0, 0.1) s = np.sin(2 * np.pi * t) s2 = np.cos(2 * np.pi * t) plt.plot(t, s, "o-", lw=4.1, label='test') plt.plot(t, s2, "o-", lw=4.1, label='test2') plt.xlabel("time (s)") plt.ylabel("Voltage (mV)") plt.title("Simple plot $\frac{\alpha}{2}$") plt.legend() plt.grid(True)
import tikzplotlib tikzplotlib.save("test.tex")
This is addressed in pull request #565. Until being merged, you can change the attribute according to the request in your local installation of tikzplotlib.
AttributeError: 'Legend' object has no attribute '_ncol'. Did you mean: '_ncols'?