Traceback (most recent call last):
File "/media/feiyu/Data/SAP3_workspace/SAP_Python/test/indictor_test.py", line 15, in
idx.plot_all(data, is_show=True, output=None)
File "/media/feiyu/Data/SAP3_workspace/SAP_Python/test/indictor.py", line 788, in plot_all
plt.plot(data["date"], data["close"], label="close")
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 3318, in plot
ret = ax.plot(*args, *kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/init.py", line 1894, in inner
return func(ax, args, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_axes.py", line 1407, in plot
self.add_line(line)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 1787, in add_line
self._update_line_limits(line)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 1809, in _update_line_limits
path = line.get_path()
File "/usr/lib/python2.7/dist-packages/matplotlib/lines.py", line 989, in getpath
self.recache()
File "/usr/lib/python2.7/dist-packages/matplotlib/lines.py", line 676, in recache
x = np.asarray(xconv, np.float)
File "/usr/lib/python2.7/dist-packages/numpy/core/numeric.py", line 531, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: invalid literal for float(): 2018-05-25
The error occurs because you are trying to plot some stuff with dates as strings on the x-axis while plt.plot() expects numerical values. Hence it fails when it tries to convert '25/05/2018' to a float, which cannot work.
Traceback (most recent call last): File "/media/feiyu/Data/SAP3_workspace/SAP_Python/test/indictor_test.py", line 15, in
idx.plot_all(data, is_show=True, output=None)
File "/media/feiyu/Data/SAP3_workspace/SAP_Python/test/indictor.py", line 788, in plot_all
plt.plot(data["date"], data["close"], label="close")
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 3318, in plot
ret = ax.plot(*args, *kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/init.py", line 1894, in inner
return func(ax, args, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_axes.py", line 1407, in plot
self.add_line(line)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 1787, in add_line
self._update_line_limits(line)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 1809, in _update_line_limits
path = line.get_path()
File "/usr/lib/python2.7/dist-packages/matplotlib/lines.py", line 989, in getpath
self.recache()
File "/usr/lib/python2.7/dist-packages/matplotlib/lines.py", line 676, in recache
x = np.asarray(xconv, np.float)
File "/usr/lib/python2.7/dist-packages/numpy/core/numeric.py", line 531, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: invalid literal for float(): 2018-05-25
The error occurs because you are trying to plot some stuff with dates as strings on the x-axis while plt.plot() expects numerical values. Hence it fails when it tries to convert '25/05/2018' to a float, which cannot work.
You need to convert your x-values to datetime objects and then use plt.plot_date, which is for example demonstrated here. https://matplotlib.org/examples/pylab_examples/date_demo1.html
repair method is change plot() to plot_date()