Skip to content
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

Inconistent numeric format on logarithmic axis labels #1920

Closed
AndiMD opened this issue Jul 30, 2017 · 3 comments · Fixed by #1930
Closed

Inconistent numeric format on logarithmic axis labels #1920

AndiMD opened this issue Jul 30, 2017 · 3 comments · Fixed by #1930
Labels
bug something broken

Comments

@AndiMD
Copy link

AndiMD commented Jul 30, 2017

Hi all,

The following example shows inconsistent x-axis labels.
Result: 10e+21, 100e+21, 1e+24, 10e+24, 100e+24, 1e+27
Expected: 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27

Can this be improved? Thanks!

<html>
<head> <script src="https://cdn.plot.ly/plotly-latest.min.js"></script> </head>
<body> 
<div id="TEST" class="plotly-graph-div"></div>
<script>
    window.PLOTLYENV=window.PLOTLYENV || {};
    window.PLOTLYENV.BASE_URL="https://plot.ly";
    Plotly.newPlot('TEST', [{"mode":"lines","y":[0.0,1.0],"type":"scatter","x":[1.0e22,1.0e27]}],
               {"xaxis":{"type":"log"},"margin":{"l":50,"b":50,"r":50,"t":60}}, {showLink: false});
</script>
</body>
</html>

CrossRef: JuliaPlots/PlotlyJS.jl#132

@etpinard
Copy link
Contributor

etpinard commented Jul 31, 2017

You might want to look at the exponentformat attribute:

https://plot.ly/javascript/reference/#layout-xaxis-exponentformat

I think for your use case, setting exponentformat: 'power' seems best, see:

https://codepen.io/etpinard/pen/VzajrW?editors=0010

@etpinard
Copy link
Contributor

etpinard commented Aug 1, 2017

@AndiMD is exponentformat: 'power' giving you the desired result?

@alexcjohnson
Copy link
Collaborator

True, exponentformat: 'power' can fix it in this case - @AndiMD the default is 'B' ie SI prefixes except for billion - but I do think there's a good argument to be made that continuing to round the exponent to a factor of 3 when we're beyond the range of SI prefixes (the range we've deemed common enough to use anyway, ie femto to tera) serves no purpose and can be misleading, so we can consider this a bug.

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

Successfully merging a pull request may close this issue.

3 participants