gonum / gonum/plot

Tick display precision should be configurable

Open
#336 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
3k
Forks
201
PR merge metrics
No merged PRs in 30d

Description

Commit https://github.com/gonum/plot/commit/2651c0e3640a62df0ece92952610e4a5579cfd95 added a displayPrecision variable in line 18 (https://github.com/gonum/plot/commit/2651c0e3640a62df0ece92952610e4a5579cfd95#diff-d7f174bedb1bfb5e7a82248d40e9b46fR18).
This variable is used to format `float64` ticks. The default value of 4 causes a small-ish number like 20000 to be rendered as `2e+04`.
The value should be configurable to allow the user to define if he ever wants scientific notation or not.

I can submit a PR that exposes `DefaultDisplayPrecision` as a global variable to plot, by changing the `const` to an exported `var` but you might have something else in mind. Please let me know how you would like to expose access to that precision without forcing the user to implement his own ticks logic just for the precision.
The approach from the wiki example on the comma separated ticks marks based on the default ticks doesn't work because at that point the tick `string` has already been generated using the displayPrecision.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.