0

When I currently run this code, the graph produced has x-axis of 2,4,6,8,10,12. How do I change it so that it displays 1,2,3,4,5,6....

from matplotlib import pyplot as plt
from matplotlib import style
import numpy as np    
style.use('ggplot')    
x,y = np.loadtxt('data.csv',
                 unpack = True,
                 delimiter = ',')
plt.bar(x,y,color = 'c', align = 'center')
plt.axis([1,12,0,20])
plt.title('Epic Chart')
plt.ylabel('Y axis')
plt.xlabel('X axis')
plt.show()

This is the csv file. Column 1 represents the month number and column 2 represents the number of sales.

This is the csv file

Xhen
  • 1
  • 1
  • Many examples on SO, for instance here: [Modify a specific x-axis tick label in python](https://stackoverflow.com/questions/38918971/modify-a-specific-x-axis-tick-label-in-python) or [here](https://stackoverflow.com/questions/11244514/modify-tick-label-text) – Mr. T Feb 28 '21 at 10:04
  • Thnx for the help!! – Xhen Feb 28 '21 at 10:18

0 Answers0