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.
Asked
Active
Viewed 1,786 times
0
-
I tried it and had no problems. – eyllanesc Jan 23 '17 at 18:17
-
are you using `plt.semilogy` ? – Pablo Reyes Jan 23 '17 at 18:43
-
Sorry, I meant I need a *scatter* plot in particular. Should have mentioned that. – Aidan Jan 23 '17 at 22:08
1 Answers
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')

Lucas
- 6,869
- 5
- 29
- 44