0

I am trying to plot some points with a date on the X axis and a numeric score on the Y axis. However, when I plot the dates list and the score list (see below)

['03 January 2021', '05 January 2021', '06 January 2021', '08 January 2021', '10 January 2021', '10 January 2021', '22 January 2021', '22 January 2021', '18 February 2021', '24 February 2021', '03 March 2021', '31 March 2021', '31 March 2021', '21 April 2021', '21 April 2021']
['94', '97', '93', '94', '96', '97', '95', '93', '95', '97', '91', '97', '97', '95', '98']

using this code:

plt.plot(dates,scores, marker='o')
plt.xlabel('Date')
plt.ylabel('Score')
plt.xticks(rotation=45)
plt.show()

I get a plot that has a messed up Y axis - it is not in numerical order: https://i.stack.imgur.com/2owQd.png

Does anyone know what's causing this or why the Y axis might be out of order?

John Kugelman
  • 330,190
  • 66
  • 504
  • 555
Sigmond Kukla
  • 29
  • 2
  • 3

1 Answers1

0

Thank you Fariborz and mkrieger1! That was the issue, and I didn't even think of it.

Sigmond Kukla
  • 29
  • 2
  • 3