I am having troubles with setting the x-ticks on my bar graph. I currently have 644 data points, so its not feasible to have a tick for each data point. Fortunately, these data points are broken out into sections (I have a list of 644 length, which is:
['a','a','a','a','a','a''a','a','b','b','b','b','b','b',...]
)
I would like for my x-axis to show when these values begin and end. there are only 6-7 different values, so it shouldn't look too cluttered.
To be honest, I'm not really sure where to start looking for this problem. I'm looking at xticks documentation and I'm not really getting anything.
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(644)
plt.bar(np.arange(len(x)),x)
plt.xlabel('x', fontsize=5)
plt.ylabel('y', fontsize=5)
plt.xticks(range(len(x_list)),x_list)
plt.locator_params(axis='x',nbins=10) #just shows first 10..not correct
plt.title('title')
plt.show()
I would like the graph to show something along the lines of where 'a' starts and ends, where 'b' starts and ends, etc.