import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
x = np.linspace(0, 4 * np.pi, 600)
y = np.sin(x)
ax.plot(x,y)
ticklabels = ['{:,.0f}'.format(x) for x in ax.get_xticks()]
ax.set_xticklabels(ticklabels)
labels = [item.get_text() for item in ax.get_xticklabels()]
print(labels)
labels[1] = 'A1'
labels[3] = 'A3'
ax.set_xticklabels(labels)
plt.savefig('ex349.png', dpi=72)
plt.show()

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading