Hello,
I have read data with dates using numpy.genfromtxt. The resulting data format is ['datetime64[D]', np.float32, np.float32]}.
Plotting the data works perfect:
dates = finances["Date"]
bar = np.cumsum(finances["Bar"])
giro = np.cumsum(finances["Giro"])
total = bar + giro
fig, ax = plt.subplots()
ax.plot(dates, bar, "-d", label = "Bar")
ax.plot(dates, giro, "-d", label = "Giro")
ax.plot(dates, total, "-D", label = "Gesamt", linewidth=3)
but using a date formatting for the x-axis and a currency format for y-axis does not work:
def formatCurrency(x):
return '%1.2f ?' % x
locator = matplotlib.dates.AutoDateLocator()
ax.xaxis.set_major_locator(locator)
ax.format_xdata = matplotlib.dates.AutoDateFormatter(locator)
ax.format_ydata = formatCurrency
fig.autofmt_xdate()
ax.grid()
ax.legend()
plt.show()
It simply shows no effect, no ? sign at y-data, the x-data is still an int-like number.
What am I doing wrong?
Thanks,
Florian