I have dataframe 'df' with 2 columns Date/Time and Value:
import numpy as np
import pandas as pd
df = pd.DataFrame(pd.date_range('2012-06-01','2012-06-04', freq='H'), columns=['date/time'])
data = np.random.randint(5, 100, 73)
temp= pd.DataFrame(data, columns=['Value'])
df['Value']=temp
df.head()
When I draw a line plot with this data by:
lines=df.plot.line(x='date/time', y='Value')
I get this graph: enter image description here
I am happy with the graph but I want my x-axis to display only the month names. Also in my actual graph, I have a lot of dates with varying months, so when displaying it the x-axis labels should not overlap. Can anyone help me with this, please?
I already looked at stuff like .xaxis.set_major_locator but I can't get it to work.