# Matplotlib Scientific Notation and Offset Text: Turn Off 1e6 on Axis Labels

> To stop Matplotlib showing 1e6 or an offset above the axis, call ax.ticklabel_format(axis="y", style="plain", useOffset=False). Also covers scilimits, useMathText, StrMethodFormatter, EngFormatter, and the ScalarFormatter error.

Source: https://www.pythoncharts.com/matplotlib/matplotlib-scientific-notation-offset/ | Published: 2026-12-05 | Author: Alex Scott | Category: Matplotlib | Tags: matplotlib, scientific notation, offset text, tick labels, ticklabel_format, formatter

To stop Matplotlib from writing `1e6` above an axis, call `ax.ticklabel_format(axis="y", style="plain")`. If the labels show an offset such as `+2.4e6` instead, add `useOffset=False`. Both settings belong to the axis's default `ScalarFormatter`, so they stop working once you set another formatter. The code was written for Matplotlib 3.11.

## Quick Example

```python
import numpy as np
import matplotlib.pyplot as plt

# Cumulative package downloads over 24 months
rng = np.random.default_rng(31)
months = np.arange(1, 25)
downloads = np.cumsum(rng.normal(130_000, 25_000, 24).round(-3))

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4), layout="constrained")
ax1.plot(months, downloads, color="#9d4edd", linewidth=2)
ax1.set_title("Default")

ax2.plot(months, downloads, color="#9d4edd", linewidth=2)
ax2.ticklabel_format(axis="y", style="plain", useOffset=False)
ax2.set_title("style='plain'")

for ax in (ax1, ax2):
    ax.set_xlabel("Month")
    ax.set_ylabel("Downloads")
plt.show()
```

![Two line charts of cumulative downloads side by side; the left y-axis shows 0.5 to 3.0 with 1e6 above the axis, the right shows plain numbers from 0 to 3000000](https://www.pythoncharts.com/matplotlib/matplotlib-scientific-notation-offset/images/matplotlib-scientific-notation-quick-example.png)

The left chart is Matplotlib's default: the tick labels read 0.5, 1.0, and so on, with `1e6` above the axis meaning "multiply by a million". The right chart prints the real numbers. Downloads reach 3,142,000 after 24 months.

## Why does Matplotlib use 1e6 on the axis?

The default y-axis formatter is `ScalarFormatter`. It switches to scientific notation when the axis reaches `axes.formatter.limits`, which defaults to `[-5, 6]`: a largest tick of 1,000,000 or more, or values below about 0.0001. Below those limits you get ordinary numbers, so 300,000 prints as `300000` but 3,000,000 prints as `3.0` with `1e6` on the axis.

There is also an offset, controlled by `axes.formatter.useoffset` (on by default). When the values sit in a narrow band far from zero, Matplotlib subtracts a common base and shows only the differences.

## Remove the offset (the +2.4e6 above the axis)

A different thing appears when the values sit in a narrow band far from zero. Matplotlib then subtracts a common base and labels the ticks with the small differences. A savings fund that earns a few dollars of interest a day on a balance of about $2.4 million is an example:

```python
days = np.arange(1, 15)
balance = 2_400_000 + np.cumsum(rng.normal(20, 6, 14)).round(2)

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4), layout="constrained")
ax1.plot(days, balance, marker="o", color="#e76f51")
ax1.set_title("Default: offset above the axis")

ax2.plot(days, balance, marker="o", color="#e76f51")
ax2.ticklabel_format(axis="y", style="plain", useOffset=False)
ax2.set_title("style='plain', useOffset=False")

for ax in (ax1, ax2):
    ax.set_xlabel("Day")
    ax.set_ylabel("Balance ($)")
plt.show()
```

![Two line charts of a fund balance over 14 days; the left y-axis shows small values such as 50 and 100 with +2.4e6 above the axis, the right shows full values such as 2400100 and 2400200](https://www.pythoncharts.com/matplotlib/matplotlib-scientific-notation-offset/images/matplotlib-scientific-notation-offset.png)

The left chart reads as "+2.4e6 plus 50, 100, 150", which hides what the balance is. The offset only appears when the spread is tiny next to the values, here about $250 on $2.4 million. You need both settings on the right: `useOffset=False` alone replaces the offset with a long `2.40010` and `1e6` above the axis, and `style="plain"` alone leaves the offset in place. `useOffset` also accepts a number, so `useOffset=2_400_000` forces that base.

## Add thousands separators

`style="plain"` prints `3000000`, which is hard to read. Switch to `StrMethodFormatter` for separators:

```python
from matplotlib.ticker import EngFormatter, StrMethodFormatter

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4), layout="constrained")
ax1.plot(months, downloads, color="#9d4edd", linewidth=2)
ax1.yaxis.set_major_formatter(StrMethodFormatter("{x:,.0f}"))
ax1.set_title("StrMethodFormatter('{x:,.0f}')")

ax2.plot(months, downloads, color="#9d4edd", linewidth=2)
ax2.yaxis.set_major_formatter(EngFormatter())
ax2.set_title("EngFormatter()")

for ax in (ax1, ax2):
    ax.set_xlabel("Month")
plt.show()
```

![Two line charts of cumulative downloads; the left y-axis uses thousands separators like 1,000,000 and the right uses abbreviations such as 1 M and 2 M](https://www.pythoncharts.com/matplotlib/matplotlib-scientific-notation-offset/images/matplotlib-scientific-notation-separators.png)

`StrMethodFormatter("{x:,.0f}")` prints `3,000,000`, and a formatter replaces `ScalarFormatter`, so there is no offset or `1e6` to turn off. `EngFormatter()` abbreviates with SI prefixes (`500 k`, `1 M`), and `EngFormatter(unit="B")` adds a unit (`1 MB`). For `$` and `%` signs, see [formatting axis labels as currency or percentages](https://www.pythoncharts.com/matplotlib/matplotlib-currency-percentage-axis-labels/).

## Force scientific notation

The opposite problem: the labels are long and you'd rather have a multiplier. `style="sci"` with `scilimits=(0, 0)` always uses it:

```python
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4), layout="constrained")
for ax in (ax1, ax2):
    ax.plot(months, downloads / 1_000, color="#2a9d8f", linewidth=2)
    ax.set_xlabel("Month")
ax1.ticklabel_format(axis="y", style="sci", scilimits=(0, 0))
ax1.set_title("scilimits=(0, 0)")

ax2.ticklabel_format(axis="y", style="sci", scilimits=(0, 0), useMathText=True)
ax2.yaxis.get_offset_text().set_fontsize(12)
ax2.set_title("useMathText=True")
plt.show()
```

![Two line charts of downloads in thousands; both y-axes show 0.0 to 3.0 with a multiplier above the axis, written 1e3 on the left and as 10 to the power 3 in math text on the right](https://www.pythoncharts.com/matplotlib/matplotlib-scientific-notation-offset/images/matplotlib-scientific-notation-force.png)

`scilimits=(m, n)` means: use scientific notation when the exponent is below `m` or above `n`. `(0, 0)` means always. `useMathText=True` draws the multiplier as `×10³` instead of `1e3`. The offset text is a normal text object, so `ax.yaxis.get_offset_text()` returns it and you can change its size, color, or font like any label. For the x-axis use `ax.xaxis.get_offset_text()`.

## Change the default for every chart

The same switches are `rcParams`. Set them once at the top of a script or notebook:

```python
plt.rcParams["axes.formatter.useoffset"] = False     # never use an offset
plt.rcParams["axes.formatter.limits"] = (-8, 9)      # use sci notation only past 1e9
plt.rcParams["axes.formatter.use_mathtext"] = True   # draw ×10³ instead of 1e3

fig, ax = plt.subplots()
ax.plot(days, balance)
plt.show()
```

`axes.formatter.limits` is the global version of `scilimits`. With `(-8, 9)`, three million prints as `3000000`. Pandas and Seaborn charts also draw on Matplotlib axes, so these settings and `ax.ticklabel_format` work on them as well. See [rcParams](https://www.pythoncharts.com/matplotlib/matplotlib-rcparams-defaults/) for more on defaults.

## AttributeError: This method only works with the ScalarFormatter

`ticklabel_format` raises this when the axis has a different formatter: you called `set_major_formatter`, used a log scale, or plotted dates. The method has nothing to configure, so the fix is to drop the call and format with the formatter you set:

```python
fig, ax = plt.subplots()
ax.plot(months, downloads)
ax.yaxis.set_major_formatter(StrMethodFormatter("{x:,.0f}"))
try:
    ax.ticklabel_format(style="plain")
except AttributeError as err:
    print(err)
plt.show()
```

On a log axis, the ticks use `LogFormatterSciNotation`. See [logarithmic axis scales](https://www.pythoncharts.com/matplotlib/matplotlib-logarithmic-axis-scale/) for formatting those.

## Which setting should I use?

| You want | Use |
|---|---|
| Real numbers, no `1e6` | `ax.ticklabel_format(axis="y", style="plain")` |
| No `+2.4e6` offset | `ax.ticklabel_format(axis="y", useOffset=False)` |
| Thousands separators | `ax.yaxis.set_major_formatter(StrMethodFormatter("{x:,.0f}"))` |
| `k` and `M` abbreviations | `ax.yaxis.set_major_formatter(EngFormatter())` |
| Always a `×10^n` multiplier | `style="sci"`, `scilimits=(0, 0)`, `useMathText=True` |
| The same for every chart | `plt.rcParams["axes.formatter.limits"]` and `["axes.formatter.useoffset"]` |

## Practical Tips

- **Pick one approach per axis.** `ticklabel_format` only works on the default `ScalarFormatter`, so calling it after `set_major_formatter` raises the AttributeError above. A formatter you set replaces the `ScalarFormatter` settings.
- **Put the unit in the label.** If you keep a multiplier, say so in the axis label (`Downloads (millions)`), or divide the data and say so, which is clearer for readers than an offset.
- **Name the axis.** Without `axis=`, `ticklabel_format` changes both axes. Pass `axis="y"` or `axis="x"` so a date or category axis isn't touched.

## Similar Topics

- [Format axis labels as currency or percentages in Matplotlib](https://www.pythoncharts.com/matplotlib/matplotlib-currency-percentage-axis-labels/)
- [Set tick positions and labels in Matplotlib](https://www.pythoncharts.com/matplotlib/matplotlib-set-ticks/)
- [Logarithmic axis scales in Matplotlib](https://www.pythoncharts.com/matplotlib/matplotlib-logarithmic-axis-scale/)
