Answers for "matplotlib set integer ticks"

0

matplotlib set integer ticks

import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
#...
ax = plt.figure().gca()
#...
ax.xaxis.set_major_locator(MaxNLocator(integer=True))
Posted by: Guest on October-29-2021
0

restrict ticks to integers matplotlib

from pylab import MaxNLocator

    ya = axes.get_yaxis()
    ya.set_major_locator(MaxNLocator(integer=True))
Posted by: Guest on June-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language