Skip to content

More flexible tick spacing #581

@bclehmann

Description

@bclehmann

What can we do to make ScottPlot better?
Currently automatic tick spacing is based on "nice numbers". These numbers are defined as a literal here: https://github.com/swharden/ScottPlot/blob/f9b4b2ad5520610c1d8bce4bba8e33bf3e318876/src/ScottPlot/Config/TickCollection.cs#L203

These give nice numbers in decimal, but not any other base. When I worked on #475 I neglected to work on this and then I forgot about it for several months :/ This is theoretically a very easy change, perhaps add another parameter for radix? Then nice numbers in hex could be [2, 2, 2, 2], giving nice numbers of [16, 8, 4, 2, 1]. And mentions to Log10 would be replaced with a call to the log function with the appropriate base.

Admittedly this is a pretty niche feature and while a function to create "nice" numbers for any radix is possible I'm unsure that it would really be used. As it is the only commonly used radices are decimal, hex, and binary. You can't really create a nice looking number in binary anyways so there's probably not much downside to just hardcoding in nice numbers for hex like was done for decimal. Might get nicer results that way too if it's hand done for each radix. If there's a compelling case that other radices might be used then I may change my mind. Keep in mind that radices above 16 are not currently supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions