0

I created many diagrams for time series and I am struggling with the x axis labels.

I have daily data , starting in November 1993 but on my x axis I would like to show only e.g. the 1st January of every 3-4 years, or maybbe just the year.

Does anyone know how I can do that?

Additionaly I would like to not show the label "Timestamp" (name of the time panda column), how can I hide that?

Any help is appreciated!

Here the code for my example diagram below:

rolling_correlation.plot(x = 'Timestamp', y = ['Average Rolling Correlation']  , color=['tab:grey'], figsize = (8,6), title = "1-Year Average Correlation of Change in Bond Yield ")
plt.ylim(0, 1)
plt.grid(axis='y')
plt.axvline(1349)
plt.axvline(1872,linestyle='dashed')
plt.axvline(3826)
plt.axvline(4153)
plt.axvline(5480)
plt.axvline(6870)
plt.show()

enter image description here

CSBossmann
  • 193
  • 2
  • 11
  • There is a similar question [here](https://stackoverflow.com/questions/45704366/how-to-change-the-datetime-tick-label-frequency-for-matplotlib-plots/). – Patrick FitzGerald Jan 16 '21 at 21:11

1 Answers1

1

I think you already have the 4-year increments in place, right? (Tell me if I'm wrong.) However, you can take the name out by just doing empty tags like this:

rolling_correlation.plot(x = '', y = ['Average Rolling Correlation']  , color=['tab:grey'], figsize = (8,6), title = "1-Year Average Correlation of Change in Bond Yield ")
  • Thanks! About the increments: I would like to alter that a bit, so that I always show the same date (1.1.2000, 1.1.2004, etc.) atm its a bit random – CSBossmann Jan 16 '21 at 16:20