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

Keep signs adjacent to numerals in output #91

Closed
dpeterson71 opened this Issue Jan 15, 2018 · 5 comments

Comments

Projects
3 participants
@dpeterson71

dpeterson71 commented Jan 15, 2018

The formatting of negative numbers is problematic with the negative sign sometimes many spaces away from the actual numbers. Even though there may be red highlighting for the negative numbers, when the sign character is 4 or 5 spaces away from the number itself, it is not clear that the sign belongs as part of the number.

@krlmlr

This comment has been minimized.

Member

krlmlr commented Jan 16, 2018

It feels easier to miss the negation sign if it's not aligned: with aligned negation signs you see at a glance which rows have negative values for that column. I agree that color helps more than the negation sign in many cases.

@dpeterson71

This comment has been minimized.

dpeterson71 commented Jan 17, 2018

I guess that is a matter of perception. I have to completely disagree with that assessment. With the current formatting, there are often cases where the sign is many spaces away and has ZERO connection to the number itself. The sign is an integral part of the number itself and should be connected to it. When I see a number I don't want to have to look many places afar to figure out whether or not it is negative. In fact, I have several cases where the formatting actually makes it look like the "negative" sign is a subtraction sign and the data look like a mathematical equation rather than numbers.

In short, the current implementation of negatives actually hinders the understanding of the output rather than improving it. The following screenshot illustrates several of these problems. With the negative signs aligned, the first column, "E", is somewhat serviceable. However, for the remaining columns, especially rows 12-16, the formatting actually looks like some sort of range since it's equidistant from the left and right data. There is no connection to the actual numbers it is supposed to help. This small subset of data also illustrates a problem with the arbitrary highlighting of three digits. With varying amounts of of leading zeroes, the highlighting is not aligned and thus ends up being distracting rather than helpful. Also note in the 2nd column that for numbers less than zero, the leading zero is not in red even though the rest of the digits are. This again is distracting and confusing.

screen shot 2018-01-17 at 9 30 29 am

@krlmlr krlmlr added this to To Do in krlmlr Feb 7, 2018

@krlmlr

This comment has been minimized.

Member

krlmlr commented Feb 8, 2018

It feels that the minus would be visible even worse if it was adjacent to the numbers. I agree that the minus e.g. in the cpsTC column looks like an arithmetic operator. We could easily replace the "-" with a " -" to make the connection more visible. How does that output look like?

@huftis

This comment has been minimized.

huftis commented Feb 8, 2018

FWIW, I find the current behaviour extremely confusing and hard to read. I don’t think adding a space before the - would help much. Having the - adjacent to the number, like we’re used to, works much better, IMHO.

@krlmlr krlmlr closed this in 25931cf Feb 22, 2018

krlmlr automation moved this from To Do to Done Feb 22, 2018

@krlmlr

This comment has been minimized.

Member

krlmlr commented Feb 22, 2018

Thanks for your feedback, the negation sign is printed adjacent to the number again.

krlmlr added a commit that referenced this issue Feb 24, 2018

Merge tag 'v1.1.0.9001'
- The negation sign is printed next to the number again (#91).
- Scientific notation uses regular digits again for exponents (#90).
- Numeric values with a `"class"` attribute are now formatted using `format()` if the `pillar_shaft()` method is not implemented for that class (#88).
- Groups of three digits are now underlined, starting with the fourth before/after the decimal point (#78).

krlmlr added a commit that referenced this issue Feb 26, 2018

Merge tag 'v1.2.0'
Display
-------

- Turned off using subtle style for digits that are considered insignificant.  Set the new option `pillar.subtle_num` to `TRUE` to turn it on again (default: `FALSE`).
- The negation sign is printed next to the number again (#91).
- Scientific notation uses regular digits again for exponents (#90).
- Groups of three digits are now underlined, starting with the fourth before/after the decimal point. This gives a better idea of the order of magnitude of the numbers (#78).
- Logical columns are displayed as `TRUE` and `FALSE` again (#95).
- The decimal dot is now always printed for numbers of type `numeric`. Trailing zeros are not displayed anymore if all displayed numbers are whole numbers (#62).
- Decimal values longer than 13 characters always print in scientific notation.

Bug fixes
---------

- Numeric values with a `"class"` attribute (e.g., `Duration` from lubridate) are now formatted using `format()` if the `pillar_shaft()` method is not implemented for that class (#88).
- Very small numbers (like `1e-310`) are now printed corectly (tidyverse/tibble#377).
- Fix representation of right-hand side for `getOption(pillar.sigfig) >= 6` (tidyverse/tibble#380).
- Fix computation of significant figures for numbers with absolute value >= 1 (#98).

New functions
-------------

- New styling helper `style_subtle_num()`, formatting depends on the `pillar.subtle_num` option.

krlmlr added a commit that referenced this issue Feb 27, 2018

Merge tag 'v1.2.1'
Display
-------

- Turned off using subtle style for digits that are considered insignificant.  Negative numbers are shown all red.  Set the new option `pillar.subtle_num` to `TRUE` to turn it on again (default: `FALSE`).
- The negation sign is printed next to the number again (#91).
- Scientific notation uses regular digits again for exponents (#90).
- Groups of three digits are now underlined, starting with the fourth before/after the decimal point. This gives a better idea of the order of magnitude of the numbers (#78).
- Logical columns are displayed as `TRUE` and `FALSE` again (#95).
- The decimal dot is now always printed for numbers of type `numeric`. Trailing zeros are not shown anymore if all displayed numbers are whole numbers (#62).
- Decimal values longer than 13 characters always print in scientific notation.

Bug fixes
---------

- Numeric values with a `"class"` attribute (e.g., `Duration` from lubridate) are now formatted using `format()` if the `pillar_shaft()` method is not implemented for that class (#88).
- Very small numbers (like `1e-310`) are now printed corectly (tidyverse/tibble#377).
- Fix representation of right-hand side for `getOption("pillar.sigfig") >= 6` (tidyverse/tibble#380).
- Fix computation of significant figures for numbers with absolute value >= 1 (#98).

New functions
-------------

- New styling helper `style_subtle_num()`, formatting depends on the `pillar.subtle_num` option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment