I need to plot some data with basic line graph.
datatime col1
29/08/2017 10:13:23.972 NaN
29/08/2017 10:13:23.972 NaN
29/08/2017 10:13:54.449 425
29/08/2017 10:14:19.800 425
29/08/2017 10:14:45.232 425
29/08/2017 10:14:48.567 NaN
29/08/2017 10:15:19.331 2
29/08/2017 10:15:38.081 380
29/08/2017 10:16:27.517 380
Now I have some problems. What I need is to plot this and if there is NaN to create a blank space on the graph, not a line from previous to next value. I used to plot with matplotlib but don't know how to integrate that "skip" step. And it would be good if it's possible to plot value on line for each jump higher or lower.
What I have:
def plot_1(data, par_time, par_y, par_ylabel, par_legend):
fig = plt.figure(figsize=(5, 3))
ax1 = fig.add_subplot(111)
plt.gca().set_color_cycle(['red', 'blue', 'green', 'brown'])
ax1.plot(data[par_time], data[par_y], label=par_ylabel, marker='o', linewidth=2.0)
plt.ylabel(par_ylabel)
handles, labels = ax1.get_legend_handles_labels()
ax1.legend(handles, par_legend, loc='upper center', bbox_to_anchor=(1.15, 1))
ax1.grid('on')
for i, j in zip(data[par_time], data[par_yticks]):
ax1.annotate(str(j), xy=(i, j))
a = plt.savefig('/home/user/graph.png)
return a
Here is not so much rows, but if it would be, x would be so congested, is it possible to create each grid on 3 seconds for example?
Thank for any help, in advance.
