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

Improve range calculation and tick spacing/placement #17

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

svetter
Copy link
Contributor

@svetter svetter commented Feb 11, 2024

Range is now chosen so that tick labels are guaranteed to be as close to the actual value they label as possible (the height of a terminal row being the limiting factor). Ticks are placed at multiples of 10^n * {1, 2, 5} so they are always round numbers.

The target number of ticks and the desired buffer at the top and bottom of the range in percent can be easily adjusted (in code).

Possible future work: Setting target tick count based on current height of terminal.

Before:

image

After:

image

Simon Vetter added 2 commits February 11, 2024 00:15
Range is now chosen so that tick labels are guaranteed to be as close to the actual value they label as possible (the height of a terminal row being the limiting factor). Ticks are placed at multiples of 10^n * {1, 2, 5} so they are always round numbers. The target number of ticks and the desired buffer at the top and bottom of the range in percent can be easily adjusted (in code).
This makes the y-axis tick labels more consistent, as there is now always one space separating the tick label from the axis line.
@aantn aantn merged commit aca2320 into aantn:main Feb 12, 2024
5 of 6 checks passed
@svetter svetter deleted the better-y-ticks branch February 12, 2024 13:17
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

Successfully merging this pull request may close these issues.

2 participants