I have some data from a csv file and that data is a dictionary whose values are numpy arrays. Here is some part of my data:
{'Date': array(['2015-01-01', '2015-01-02', '2015-01-03', ..., '2017-12-29',
'2017-12-30', '2017-12-31'], dtype='<U11'), 'Year': array([2015, 2015, 2015, ..., 2017, 2017, 2017]), 'Month': array([ 1, 1, 1, ..., 12, 12, 12]), 'Day': array([ 1, 2, 3, ..., 29, 30, 31]), 'Consumption': array([1111.336 , 1300.884 , 1265.271 , ..., 1295.0875, 1215.449 ,
1107.1149]), 'Wind': array([325.128, 603.558, 462.953, ..., 584.277, 721.247, 721.176]), 'Solar': array([17.079, 7.758, 7.236, ..., 29.854, 7.467, 19.98 ])}
Then, according to that data, I plotted a graph whose x values are dates and y values are consumption, wind and solar information from the data. Let me show you my graph and code:
plt.plot(data['Date'], data['Consumption'], label= 'Consumption')
plt.plot(data['Date'] , data['Wind'], label= 'Wind')
plt.plot(data['Date'] , data['Solar'], label='Solar')
plt.legend()
Here is my problem. I need to use xticks function to put the month and year information onto the x axis. For example, when my y values show the information of '2015-01-01' date, I need to put 'Jan15' string onto the x axis. I need to do that for all first days of months like 'Feb15' ..... 'Dec17'. The result should be like that:
Can someone help me about that?