0

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.

Here is the plot I have made.

enter image description here

Blue represents using plt.yscale('log'), whereas the orange is creating a new column and applying np.log onto the data.

My question

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!

edit(1)

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.

Luke Teo
  • 87
  • 7
  • @AsishM. thanks for the comment! I gave `np.log10` a try and it is giving a smaller value than if I did `np.log`. – Luke Teo Mar 28 '21 at 03:46

1 Answers1

1

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)

enter image description here

If I log scale it:
It's just more exaggerated

plt.plot(x, y)
plt.xscale('log')

enter image description here

You need to point your data the other direction like normal log data

plt.plot(-x, y)

enter image description here

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')

enter image description here

piRSquared
  • 285,575
  • 57
  • 475
  • 624