Log scale plot
A logarithmic axis spaces powers of ten equally, so data spanning several orders of magnitude fits on one chart and exponential growth or power laws appear as straight lines.
When to use it
- Values span more than two orders of magnitude.
- You expect exponential growth (semi-log) or a power law (log-log).
- Relative change matters more than absolute change.
Watch out: Log scales can't show zero or negative values. Use symlog, or drop those values deliberately.
Ask for it in pltchat
Upload your file and type something like:
"log scale on y"
pltchat writes the loader and the plot for your columns, runs it in your browser and shows you the code.
The matplotlib code
Self-contained with example data; swap in pd.read_csv(...) or
pd.read_excel(...) for your own file.
import numpy as np
import matplotlib.pyplot as plt
days = np.arange(0, 60)
cases = 10 * np.exp(0.12 * days)
cases_slow = 10 * np.exp(0.07 * days)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(7.5, 3.6))
for ax in (ax1, ax2):
ax.plot(days, cases, label="12%/day")
ax.plot(days, cases_slow, label="7%/day")
ax.set_xlabel("Day")
ax1.set_title("Linear y")
ax2.set_yscale("log")
ax2.set_title("Log y: exponential is a straight line")
ax1.set_ylabel("Count")
ax2.legend()
plt.tight_layout()
plt.show()
Upload a CSV, Excel, JSON or Parquet file. Your first plot is always free.