You are reading an old version of the documentation (v1.2.1). For the latest version see

This Page

api example code: engineering_formatter.pyΒΆ

(Source code, png, hires.png, pdf)

Demo to show use of the engineering Formatter.

import matplotlib.pyplot as plt
import numpy as np

from matplotlib.ticker import EngFormatter

ax = plt.subplot(111)
formatter = EngFormatter(unit='Hz', places=1)

xs = np.logspace(1, 9, 100)
ys = (0.8 + 0.4 * np.random.uniform(size=100)) * np.log10(xs)**2
ax.plot(xs, ys)

Keywords: python, matplotlib, pylab, example, codex (see Search examples)