I've two lists:
time_str = ['06:03' '06:03' '06:04' ..., '19:58' '19:59' '19:59']
value = ['3.25' '3.09' '2.63' ..., '2.47' '2.57' '2.40']
I tried below code but got error:
plt.plot(time_str,value)
plt.xlabel('Time')
plt.show()
ValueError: invalid literal for float(): 06:00
How can I plot time_str on x_axis and value on y axis. time_str has values for every minute and maybe we can show for every 15 minutes ticks on x axis.I tried in several ways but I couldn't get the line plot properly. Can anyone suggest
Edit: After some trials, I have this code yet I don't have appropriate labels on the axis (It appears as though python just tried to scratch something):
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.xaxis.set_major_locator(md.MinuteLocator(interval=15))
ax.xaxis.set_major_formatter(md.DateFormatter('%H:%M'))
plt.plot(y)
plt.xticks(range(len(x)), x)
plt.show()