2
plt.figure(figsize=(4,4))
aapl_data.plot.line(x='Date',y='Adj Close',title='test')
plt.ylabel('Adj Close')plt.show()

enter image description here

How do i declutter the X axis. I tried using figsize in the code but it does not do anything

Colin Giam
  • 21
  • 1

3 Answers3

1

Better show the whole code. Since I'm not sure if you have such a string: ax = plt.axes()

ax.xaxis.set_major_locator(mdates.DayLocator(interval = 3))
inquirer
  • 4,286
  • 2
  • 9
  • 16
1

Try to formate the date

ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%b'))
0

There can be two solutions to this problem.

  1. Increasing the width of the window. This can be achieved by:
import matplotlib.pyplot as plt


fig = plt.figure(figsize=(40,4))
fig.add_subplot(1,1,1).plot([1,2,3], [1,2,3])
plt.show()

  1. Making the labels vertical rather than horizontal. This can be done by:
plt.xticks(range(10), rotation='vertical')
Anshumaan Mishra
  • 1,349
  • 1
  • 4
  • 19