4
I am unable to specify values for my x-axis, using matplotlib.pyplot.
In some images the chart.xticks(years)
solves the problem, but it seems that when the x-axis value set is too small, it uses standard values [0,1,2,...,N]
My code until then:
import matplotlib.pyplot as chart
from matplotlib import lines
# Settings
chart.title(file_name)
chart.xlabel('Years')
chart.ylabel('Committers/Contributions')
chart.ylim([0,highest_value + 100])
chart.xlim(first_year,2017)
# Values
committer_line = chart.plot(committers_dict.keys(),committers_dict.values(),'r',label='Committer')
contribution_line = chart.plot(contributions_dict.keys(),contributions_dict.values(),'b--',label='Contribution')
years = list(range(first_year,2017))
chart.xticks(years)
# Legend
chart.legend()
# Show/Save
chart.savefig(images_path + file_name.replace('.txt','-commiter-contribution.eps'), format='eps')
chart.show()