tikzplotlib icon indicating copy to clipboard operation
tikzplotlib copied to clipboard

Adding a legend causes AttributeError

Open Daniel003203 opened this issue 2 years ago • 2 comments
trafficstars

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")

Daniel003203 avatar Dec 21 '22 14:12 Daniel003203

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.

eqnmapper avatar Jan 02 '23 22:01 eqnmapper

AttributeError: 'Legend' object has no attribute '_ncol'. Did you mean: '_ncols'?

Liu-Yinlong avatar Apr 02 '23 05:04 Liu-Yinlong