olavolav / uniplot

Lightweight plotting to the terminal. 4x resolution via Unicode.
MIT License
343 stars 16 forks source link

Missing precision on x axis values, making them identical #5

Closed AntoineSto closed 3 years ago

AntoineSto commented 3 years ago

Hello Olav, I have noticed a small problem when displaying the x axis values. The values seem to be rounded too much making them identical and equal to 0. It seems to happen when one value is positive, the other negative and the values are close to 0 (+-0.01) I included screenshots of it.

PS: uniplot feels great, keep it up!

Screenshot 2021-01-22 at 16 58 48 Screenshot 2021-01-22 at 17 08 59
olavolav commented 3 years ago

You're right, thanks for this issue, and glad that you enjoy uniplot! 😄

Indeed the numbers are rounded too much, the comparison thinks they are different enough due to the different sign, which doesn't make sense here. I'll think of something.

olavolav commented 3 years ago

So I have a fix and will publish it later.

I've actually played around with the idea of adding more sophisticated axis labels as in Talbot, J., Lin, S. & Hanrahan, P. An Extension of Wilkinson’s Algorithm for Positioning Tick Labels on Axes. IEEE T Vis Comput Gr 16, 1036–1043 (2010) but this will still take some time to get right.

olavolav commented 3 years ago

@AntoineSto Just for your information, I finally finished and pushed the nicer axis labels yesterday 😄