-1

I made a line plot in python, but it won't show up properly. I used sort_values() so that the x-labels will be ordered. But as you can see in the picture, the x-labels aren't in order. i.e 202307 is in front of 202211

Line Plot

Here's the code I wrote.

plt.figure(figsize=(36,16))
plt.plot(name0['date'], name0['count'], label = name_list[0], color="green")
plt.plot(name1['date'], name1['count'], label = name_list[1], color = "hotpink") 
plt.grid('-')
plt.xticks(rotation=45)
plt.legend()
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Jenna
  • 21
  • 3

0 Answers0