Apr-04-2022, 01:06 PM
(Apr-03-2022, 10:45 PM)Larz60+ Wrote: see: https://matplotlib.org/3.1.1/gallery/tic..._demo.html
How do you suggest I implement that?
I had previously worked successfully with this Class and np.linspace() as the first argument.
This does not work:
import matplotlib a = ['2017-01-06', '2017-01-13', '2017-01-20', '2017-01-27', '2017-02-03', '2017-02-10', '2017-02-17', \ '2017-02-24', '2017-03-03', '2017-03-10', '2017-03-17', '2017-03-24', '2017-03-31', '2017-04-07', \ '2017-04-14', '2017-04-21', '2017-04-28', '2017-05-05', '2017-05-12', '2017-05-19'] b = [433, 1216, 1234, 2175, 2825, 3271, 3240, 2979, 2234, 3114, 3139, 2975, 3831, 3758, 4127, 4900, 4216,\ 4785, 4043, 4346] fig, ax = plt.subplots(1) ax.plot(a,b) ax.xaxis.set_major_locator(matplotlib.ticker.FixedLocator(list(pd.date_range('2010-01-01', '2011-12-31',5)))) plt.xticks(rotation=90) plt.show()With or without that list() constructor, I get TypeError: type Timestamp doesn't define __round__ method