In python plots, what does "1e8" mean in reference to the y-axis?
1e8
is standard scientific notion, and here it indicates an overall scale factor for the y-axis. That is, if there's a 2
on the y-axis and a 1e8
at the top, the value at 2
actually indicates 2*1e8 = 2e8 = 2 * 10^8 = 200,000,000
.
Note that exp(20) = 4.85e8
and exp(3) = 20.1
, and since the first number is too large to conveniently express directly and the second one can be expressed directly, you have the scientific notation in the first and not (explicitely) in the second.
Truxton Boyce
Updated on July 09, 2022Comments
-
Truxton Boyce almost 2 years
Here is my code:
import numpy as np import matplotlib.pyplot as plt def f(x): return np.exp(x) x=np.linspace(-20,20,201)
I am plotting e^x in python, and when I create equally spaced points with linspace, the y-axis seems to be doing funny things. When I choose:
x = np.linspace(-20,20,201)
the y-axis doesn't appear correct, the function is supposed to be crossing the y-axis at 1 when x = 0. However it doesn't appear to be so in the plot. On top of the y-axis it says le8. What does that mean?
However, When I try:
x = np.linspace(0,3,201)
The plot crosses the y-axis at 1 when x = 0 which is correct. However, the plot doesn't have "le8" on it.
-
jonrsharpe over 9 yearsDo you mean
1e8
, i.e.1 * (10 ** 8)
? -
Truxton Boyce over 9 yearsThats a good question...I thought it was the letter "l". 1*10^8 is definitely more meaningful. But how does that affect the y-axis? the y-axis in the plot has the integers 1, 2, 3, 4...and the dependent values of the function cross the y-axis well below 1. The values are actually 1 * 10^8 I suppose?
-
zyy over 2 yearsYou can get rid of it with
plt.ticklabel_format(useOffset = False)
.
-