Reputation: 167
I'm trying to plot a time series plot to show the number of tweet per minute over a particular one hour time period. I have a problem with the x-axis entries as it looks gibberish. Can you please help me solve this issue ?
fig = plt.figure(figsize = (8,8))
plt.plot(list(timedict.keys()), list(timedict.values()))
plt.xlabel('minute', fontsize=12)
plt.ylabel('tweets number', fontsize=12)
plt.xlim([1,20])
plt.xticks(list(timedict.keys()), fontsize=15, rotation=90)
plt.title('Number of tweets at each minute', fontsize = 20)
plt.show()
Upvotes: 0
Views: 234
Reputation: 436
I believe that you have many 'ticks' on the x axis... You could space them by doing something like:
minuteLength = 1
plt.xticks(np.arange(min(timedict.keys()), max(timedict.keys())+1, minuteLength))
Don't forget to adjust the value of minuteLength to a reasonable interval from your dictionary...
Upvotes: 1