0

I have the following set of irregularly sampled measurements:

time = [2018-09-19 12:54:58, 2018-09-19 17:16:55, 2018-09-19 21:35:09, 2018-09-20 01:54:01, 2018-09-20 06:12:35, 2018-09-20 10:32:41, 2018-09-20 14:50:52, 2018-09-20 19:09:07, 2018-09-20 23:28:01, 2018-09-21 03:46:10, 2018-09-21 08:05:50, 2018-09-21 12:24:52, 2018-09-21 16:43:39, 2018-09-21 21:02:33, 2018-09-22 01:21:11, 2018-09-22 05:39:52, 2018-09-22 09:58:41, 2018-09-22 14:16:55, 2018-09-22 18:35:32, 2018-09-22 22:54:54]

data = [19.651838, 19.512057, 19.399803, 19.215035, 19.068782, 19.000058, 18.851315, 18.675435, 18.543213, 18.402075, 18.278012, 18.172428, 17.963735, 17.749883, 17.647737, 17.496292, 17.370942, 17.216092, 16.951800, 16.683553]

And I would like to plot them with the x-ticks being integer numbers, so 2018-09-19 12:54:58 would be 0, 2018-09-20 would be 1 and so on.

Does anyone have suggestions?

Thank you in advance.

vicemagui
  • 154
  • 13
  • Your approach would have multiple zeros on the x-axis. Do you mean instead `plt.plot(range(data), data)`? And what is `time`? Timestamps, datetime objects, strings? – Mr. T Mar 02 '21 at 10:23
  • 1
    Time contains timestamps – vicemagui Mar 02 '21 at 10:27
  • Then edit your question to explain what "does not work". The link to pandas is also unclear. So far, you have mentioned two lists. – Mr. T Mar 02 '21 at 10:35

0 Answers0