0

My Code

over = list(range(1,21))
bangladesh = [10, 12, 15, 19, 22, 33, 40, 54, 67, 77, 89, 102, 120, 135, 155, 170, 195, 209, 220, 235]
india = [1, 6, 10, 19, 22, 31, 32, 34, 47, 54, 67, 79, 100, 125, 135, 140, 145, 157, 168, 175]

plt.plot(over, bangladesh, label='Bangladesh')
plt.plot(over, india, label='India')
plt.title('Run Overflow')
plt.xlabel('Over')
plt.ylabel('Run')
plt.legend(loc='best')
plt.show()

This is my output of this code

Here is show the over count 2.5, 5, 7.5 ... but i want to see the over 1, 2, 3, 4, 5..... so, how can i do this ?

Sajib Hossain
  • 81
  • 1
  • 12
  • https://stackoverflow.com/questions/12608788/changing-the-tick-frequency-on-x-or-y-axis-in-matplotlib Is your answer – Jason Chia Dec 12 '19 at 10:10

1 Answers1

0

You need to add plt.xticks:

over = list(range(1,21))
bangladesh = [10, 12, 15, 19, 22, 33, 40, 54, 67, 77, 89, 102, 120, 135, 155, 170, 195, 209, 220, 235]
india = [1, 6, 10, 19, 22, 31, 32, 34, 47, 54, 67, 79, 100, 125, 135, 140, 145, 157, 168, 175]

plt.plot(over, bangladesh, label='Bangladesh')
plt.plot(over, india, label='India')
plt.title('Run Overflow')
plt.xlabel('Over')
plt.ylabel('Run')
plt.xticks(range(1,21))
plt.legend(loc='best')
plt.show()

enter image description here

Sayandip Dutta
  • 15,602
  • 4
  • 23
  • 52