xaxis matplotlib

Solutions on MaxInterview for xaxis matplotlib by the best coders in the world

showing results for - "xaxis matplotlib"
Hannah
10 Jan 2019
1import matplotlib.pyplot as plt
2x = [0.00001,0.001,0.01,0.1,0.5,1,5]
3# create an index for each tick position
4xi = list(range(len(x)))
5y = [0.945,0.885,0.893,0.9,0.996,1.25,1.19]
6plt.ylim(0.8,1.4)
7# plot the index for the x-values
8plt.plot(xi, y, marker='o', linestyle='--', color='r', label='Square') 
9plt.xlabel('x')
10plt.ylabel('y') 
11plt.xticks(xi, x)
12plt.title('compare')
13plt.legend() 
14plt.show()