api example code: engineering_formatter.py — Matplotlib 2.0.2 documentation
You are reading an old version of the documentation (v2.0.2). For the latest version see https://matplotlib.org/stable/ Navigation index modules | next | previous | home | examples | gallery | pyplot | docs » Matplotlib Examples » api Examples » Travis-CI: Related Topics Documentation overview Matplotlib Examples api Examples Previous: api example code: donut_demo.py Next: api example code: filled_step.py This Page Show Source Quick search api example code: engineering_formatter.py ¶ ( Source code , png , pdf ) ''' ========================================= Labeling ticks using engineering notation ========================================= Demo to show use of the engineering Formatter. ''' import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import EngFormatter prng = np . random .
RandomState ( 123 ) fig , ax = plt . subplots () ax . set_xscale ( 'log' ) formatter = EngFormatter ( unit = 'Hz' ) ax . xaxis . set_major_formatter ( formatter ) xs = np . logspace ( 1 , 9 , 100 ) ys = ( 0.8 + 0.4 * prng . uniform ( size = 100 )) * np . log10 ( xs ) ** 2 ax . plot ( xs , ys ) plt . show () Keywords: python, matplotlib, pylab, example, codex (see Search examples ) © Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2016 The Matplotlib development team.
Last updated on May 10, 2017. Created using Sphinx 1.5.5.