{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# SI prefixed offsets and natural order of magnitudes\n\n`matplotlib.ticker.EngFormatter` is capable of computing a natural\noffset for your axis data, and presenting it with a standard SI prefix\nautomatically calculated.\n\nBelow is an examples of such a plot:\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\nimport matplotlib.ticker as mticker\n\n# Fixing random state for reproducibility\nnp.random.seed(19680801)\n\nUNIT = \"Hz\"\n\nfig, ax = plt.subplots()\nax.yaxis.set_major_formatter(mticker.EngFormatter(\n    useOffset=True,\n    unit=UNIT\n))\nsize = 100\nmeasurement = np.full(size, 1e9)\nnoise = np.random.uniform(low=-2e3, high=2e3, size=size)\nax.plot(measurement + noise)\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.14.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}