How to set ticks on Fixed Position , matplotlib

Just use ax.set_xticks(positions) or ax.set_yticks(positions).

For example:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.set_xticks([0.15, 0.68, 0.97])
ax.set_yticks([0.2, 0.55, 0.76])
plt.show()

enter image description here

Leave a Comment