I am currently working up some experimental data and am having a hard time understanding whether I should be doing a log scale or actually applying np.log onto the data.
Blue represents using plt.yscale('log')
, whereas the orange is creating a new column and applying np.log
onto the data.
Why are their magnitudes so different? Which is correct? and if using plt.yscale('log')
is the optimal way to do it, is there a way I can get those values as I need to do a curve fit after?
Thanks in advance for anyone that can provide some answers!
I understand that plt.yscale('log')
is in base 10 and np.log
refers to the natural log. I have tried using np.log10
on the data instead and it gives a smaller value that does not correspond to using a log scale.
Your data is getting log-ified but "pointing"? in the wrong direction.
Consider this toy data
x = np.linspace(0, 1, 100)[:-1]
y = np.log(1-x) + 5
Then we plot
plt.plot(x, y)
If I log scale it:
It's just more exaggerated
plt.plot(x, y)
plt.xscale('log')
You need to point your data the other direction like normal log data
plt.plot(-x, y)
But you also have to make sure the data is positive or ... you know ... logs and stuff ¯\_(ツ)_/¯
plt.plot(-x + 1, y)
plt.xscale('log')