change axis and axis label color matplotlib

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)

ax.plot(range(10))
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')

ax.spines['bottom'].set_color('red')
ax.spines['top'].set_color('red')
ax.xaxis.label.set_color('red')
ax.tick_params(axis='x', colors='red')

plt.show()

Here is what the above code is Doing:
1. We’re creating a figure and adding a subplot to it.
2. We’re plotting a line on the subplot.
3. We’re setting the x-axis label and the y-axis label.
4. We’re setting the color of the bottom and top spines to red.
5. We’re setting the color of the x-axis label to red.
6. We’re setting the color of the x-axis ticks to red.
7. We’re displaying the plot.