'Change X-axis for timeseries plot in Python
So I have a dataframe like this:
| YM | YQMD | YQM | Year | Quarter | Month | Day | srch_id |
|---|---|---|---|---|---|---|---|
| 2012-11 | 2012-4-11-01 | 2012-4-11 | 2012 | 4 | 11 | 01 | 3033780585 |
| 2012-11 | 2012-4-11-02 | 2012-4-11 | 2012 | 4 | 11 | 02 | 2812558229 |
| .. | |||||||
| 2013-06 | 2013-2-06-26 | 2013-2-06 | 2013 | 2 | 06 | 26 | 5000321400 |
| 2013-06 | 2013-2-06-27 | 2013-2-06 | 2013 | 2 | 06 | 27 | 3953504722 |
Now I want to plot a lineplot. I did it with this code:
#plot lineplot
sns.set_style('darkgrid')
sns.set(rc={'figure.figsize':(14,8)})
ax = sns.lineplot(data=df_monthly, x ='YQMD', y = 'click_bool')
plt.ylabel('Number of Search Queries')
plt.xlabel('Year-Month')
plt.show()
This is the plot that I got and as you can see, the x-axis you cannot see the dates etc, because they are too much.

The pattern of the plot is the right way that I want it, but is it possible to get the x-axis like this below?:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

