Skip to content

Is there no log base 2? #4147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LDubya opened this issue Aug 23, 2019 · 1 comment
Closed

Is there no log base 2? #4147

LDubya opened this issue Aug 23, 2019 · 1 comment

Comments

@LDubya
Copy link

LDubya commented Aug 23, 2019

Is there any way to use a log base 2 scale? Currently the log scale is implemented in base 10.

If this is not currently a feature, then if you can show us where in the code to edit, we might try to implement a "log2" type ourselves and submit a pull request.

There is a similar discussion, #2362, but that discussion is far bigger in scope, requesting fully customizable log bases. We just need a log base 2, which is quite standard.

@LDubya
Copy link
Author

LDubya commented Aug 23, 2019

So I've answered my own question. We can use dtick to accomplish this in combination with "type" set to "log".

With a "type" set to "log", dtick takes a number such that ticks are set every 10^(n"dtick) .

So dtick allows us to use the change of base formula to change the base.

A base 2 axis can be constructed with a type set to "log" and a dtick set to log10(2), or 0.30102999566.

A base 5 axis can be constructed with a type set to "log" and a dtick set to log10(5), or 0.69897000433.

etc.

So this should also work for #2362.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant