Matplotlib.ticker.FuncFormatter class in Python Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.ticker.FuncFormatter The matplotlib.ticker.FuncFormatter class uses a user defined function for formatting. This user defined function must take two values as inputs for a tick value x and a position pos. Syntax: class matplotlib.ticker.FuncFormatter(func)Parameter: func: The user defined function for formatting of the plot. Example 1: Python3 import matplotlib.pyplot as plt import matplotlib.ticker as tick import numpy as np x = np.linspace(0, 10, 1000) y = 0.000001 * np.sin(10 * x) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y) def y_fmt(x, y): return '{:2.2e}'.format(x).replace('e', 'x10^') ax.yaxis.set_major_formatter(tick.FuncFormatter(y_fmt)) plt.show() Output: Example 2: Python3 import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter fig, ax = plt.subplots() ax.axis([0.01, 10000, 1, 1000000]) ax.loglog() for axis in [ax.xaxis, ax.yaxis]: formatter = FuncFormatter(lambda y, _: '{:.16g}'.format(y)) axis.set_major_formatter(formatter) plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.ticker.FuncFormatter class in Python R RajuKumar19 Follow Improve Article Tags : Python Write From Home Python-Library Python-matplotlib Practice Tags : python Similar Reads Matplotlib.ticker.LogFormatter Class in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.ticker.LogFormatter The matplotlib.ticker.LogFormatter class is used for form 2 min read Matplotlib.ticker.IndexFormatter class in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.ticker.IndexFormatter The matplotlib.ticker.IndexFormatter class is a subclas 2 min read Matplotlib.ticker.FixedLocator Class in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.ticker.FixedLocator The matplotlib.ticker.FixedLocator class is a subclass of 2 min read Matplotlib.ticker.LogLocator Class in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.ticker.LogLocator The matplotlib.ticker.LogLocator class is used to determine 2 min read Matplotlib.ticker.LinearLocator Class in Python Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.ticker.LinearLocator The matplotlib.ticker.LinearLocator class is used to det 2 min read Like