May-24-2018, 07:27 AM
How to show timestamps on x axis as "%Y-%m-%d %H:%M". ts is list of timestamps and how to show on x axis only values "2018-5-23 14:00", "2018-5-23 14:15" and "2018-5-23 14:30".
My current chart shows: 23 14:00, 23 14:05, 23 14:10, 23 14:15, 23 14:20, 23 14:25, 23 14:30.
Chart
My current chart shows: 23 14:00, 23 14:05, 23 14:10, 23 14:15, 23 14:20, 23 14:25, 23 14:30.
Chart
import datetime import matplotlib.pyplot as plt from matplotlib import style style.use('fivethirtyeight') ts = [datetime.datetime(2018, 5, 23, 14, 0), datetime.datetime(2018, 5, 23, 14, 15), datetime.datetime(2018, 5, 23, 14, 30)] values =[3, 7, 6] plt.plot(ts, values, 'o-') plt.show()