How to change yscales

Hi everyone,
I’m working with sns.distplot and I want to transform the values on y-axis to their log value. for example. I want to change 0.01 to -2 (which is log(0.01))

Thank you

distplot returns a matplotlib Axes object which has a set_yscale method, so

ax = sns.distplot(...)
ax.set_yscale("log")

will do it. Note that matplotlib labels ticks on a log axis with 10^2, 10^3, etc, so if you just want to show the exponent you’ll need to use ax.set_yticklabels as well.

1 Like

I want only the exponent, but I couldn’t implement it!
Would you write an example for clarification?

Thanks

I think there are a number of examples on StackOverflow, here’s a particularly robust approach: python - matplotlib log axis: display powers of 10 only - Stack Overflow