posit-dev / great-tables

Make awesome display tables using Python.
https://posit-dev.github.io/great-tables/
MIT License
1.43k stars 48 forks source link

Integer or integerlike values should be displayed as integers in nanoplots #279

Closed rich-iannone closed 2 months ago

rich-iannone commented 2 months ago

If all values for a single nanoplot are integerlike, the displayed values should not contain decimal values filled with zeroes. The problem can be seen in the example page at https://posit-dev.github.io/great-tables/get-started/nanoplots.html. Here's a screenshot showing the issue:

nanoplot_displayed_number

All values in the bottom plot don't have non-zero decimal parts (they are parsed from the string: "2 0 15 7 8 10 1 24 17 13 6") so the third value should display as 15 and not 15.0.

When numbers are autoformatted for nanoplots, the aim is to have the most compact and consistent display (and the user could provide a function for formatting as a customization). So, removing unnecessary digits makes sense here.