My python script uses matplotlib to plot a 2D \"heat map\" of an x, y, z dataset. My x- and y-values represent amino acid residues in a protein and can therefore only be int
This should be simpler:
(from https://scivision.co/matplotlib-force-integer-labeling-of-axis/)
import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator #... ax = plt.figure().gca() #... ax.xaxis.set_major_locator(MaxNLocator(integer=True))