Search code examples
pythonpython-3.xaxis-labels

Axis labels are not showing in Python


Can someone explain why xticks are not showing for the following code?

import numpy as np
import matplotlib.pyplot as plt

a,b = np.arange(0,0.3,0.01),np.arange(0,0.3,0.01)
plt.plot(a,b,'k','Linewidth', 1.5)
plt.axis([0.15, 0.25, 0.05, 0.3])
plt.show()

Solution

  • Change the line plt.plot(a,b,'k','Linewidth', 1.5) to plt.plot(a,b,'k',Linewidth=1.5), then x-axis will show as it should