Skip to content

Make log scale configurable #2362

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
oc37ejuc opened this issue Feb 13, 2018 · 11 comments
Closed

Make log scale configurable #2362

oc37ejuc opened this issue Feb 13, 2018 · 11 comments
Labels
feature something new

Comments

@oc37ejuc
Copy link

Hi there,

would it be possible to make the axis log scaling base configurable?

I have some data sets that need to be plotted with a logarithmic scale, and due to the nature of the data, base 10 does not make sense.

Kind regards,
oc37ejuc

@etpinard
Copy link
Contributor

Yeah, we could add a new axes type e.g. xaxis.type: 'ln'


This won't be a priority for us in the near future, but we'll gladly look at a PR from the community.

Referencing a similar request: #221

@etpinard etpinard added the feature something new label Feb 13, 2018
@alexcjohnson
Copy link
Collaborator

This doesn't need to be a different type, just a new attribute (base?) to change how ticks are drawn. The tricky thing here will be to find a nice algorithm for choosing tick values for arbitrary range / nticks combinations, and it might be too much to ask that this also work well for an arbitrary base, perhaps it's more realistic to make the framework and separate algorithms for each specific base someone needs.

@ghost
Copy link

ghost commented Feb 16, 2018

Although we just need it for the base 2, the approach using an arbitrary base value might prove useful to others. Unfortunately I can't code any Java*, but I can offer some suggestions on the tick-drawing algorithm:

Major ticks are drawn at all multiples of base in the range.

If current_major and next_major are the positions of the current and the next major ticks, between which a total of n minor ticks should be drawn then the minor ticks should be placed at
current_major * nearest_integer(factor**n_tick), where n_tick is the number of the current minor tick and factor is the n+1th root of base.

@pewinski
Copy link

pewinski commented Oct 8, 2018

I've step into similar problem when developing for my client.

What they want is a way to represent a curve using 10 based log scale of axis (including values lower or equal to 0, similarly to symlog. These are cutoff in current implementation of logarithmic axis).

@Berkmann18
Copy link

It would be nice to use log2 or ln instead of log10.

@archmoj
Copy link
Contributor

archmoj commented May 25, 2020

It would be nice to use log2 or ln instead of log10.

And the natural logarithm too?

@Berkmann18
Copy link

@archmoj

And the natural logarithm too?

That's what ln is.

@esternin
Copy link

esternin commented Jul 1, 2020

I think adding a base value to the call is the best. I would also allow for any number +/-3% of e to result in ln, but outside of this range, treat base numbers as exactly the base that is desired.

xaxis: {type: 'log', logbase: 2.7}

would be the way to get ln. The default value should be 10 for the logbase.

The scaling of the axes (min,max,step) should be in logs of values, if type=='log'. For example 32=2^5, so to cover max(x)=32 the range of x should have the upper limit of 5.

That's my vote.

@gvwilson
Copy link
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

@esternin
Copy link

esternin commented Jun 11, 2024 via email

@gvwilson
Copy link
Contributor

Thank you for your comment - as mine said, we are trying to clean up our public repositories (which currently have over 3500 open issues, some going back more than eight years), and there had been no activity on this issue in four years. It's not on our roadmap, but if someone would like to contribute a pull request we will review it as quickly as we can.

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

No branches or pull requests

8 participants