0

I need to plot my y-axis using a logarithmic scale. yscale("log") or yscale("symlog") only scales the axis for positive powers of 10, i.e. 10^1, 10^2, 10^3, etc. My data are mainly less than one. Therefore I need to plot a y axis scaled to 10^-1, 10^-2, 10^-3, all the way to 10^-9 or 10^-10. How could I go about doing this? Much thanks.

m_callens
  • 6,100
  • 8
  • 32
  • 54
Aidan
  • 11
  • 2

1 Answers1

0

We use .set_yscale('log') on the axes simply. Here a simple example:

# Create sample data
x = np.arange(0, 20)
y = np.linspace(1e-9, 1e-1, 20)

plt.plot(x, y, 'o--')
plt.gca().set_yscale('log')

example_log_y

Lucas
  • 6,869
  • 5
  • 29
  • 44