GNOME Bugzilla – Bug 588516
SI/engineering prefixes in plots and formatting
Last modified: 2011-09-01 06:11:10 UTC
It would be good if there were the ability to format numbers with engineering/SI prefixes + units for powers of ten (eg. 1e3 = k, 1e6 = M, 1e-3 = m) etc. This would be useful as both a spreadsheet formatting option and a chart axis marker option (similar to the scientific + engineering option). More explicitly, if I have measurements of voltage vs. frequency, I would like the x-axis markers to be Hz, kHz, MHz, etc on a logarithmic plot. See http://mail.gnome.org/archives/gnumeric-list/2009-July/msg00010.html
This is an interesting concept and the format engine can probably be goaded into doing this. The plot axis would follow with no additional work. I think. What should be done for weight? The SI unit is "kg", i.e., it already contains a prefix. That is quite inconvenient as we generally have no idea what unit we're dealing with.
I am pretty sure that the SI unit for weight is "g" (gram).
I guess I was mistaken: "It is important to note that the kilogram is the only SI unit with a prefix as part of its name and symbol. Because multiple prefixes may not be used, in the case of the kilogram the prefix names of Table 5 are used with the unit name "gram" and the prefix symbols are used with the unit symbol "g." With this exception, any SI prefix may be used with any SI unit, including the degree Celsius and its symbol °C." But of course that should not be an issue. We can behave as if "g" is the unit for mass.
> But of course that should not be an issue. We can behave as if "g" is the > unit for mass. That's what I'd suggest. I ended up implementing a similar thing in Matplotlib, and this post might have some details that help (in Python, but still): http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14433.html Note that it was tweaked a bit by others before ending up in their code base.
> But of course that should not be an issue. We can behave as if "g" is the unit > for mass. I strongly disagree. One of the major points of the SI *system* is that the units are scaled properly with respect to each other. Example: what is the force needed to accelerate 5kg by 4m/s^2? Answer: 20N (aka 20 kg m/s^2). We need the number 5 to show as "5 kg" and the 4 to show as "4 m/s^2" so the cell with the product can show as "20 N". If we need to have 5000 in order to get "5 kg", the whole benefit goes out the window.
Created attachment 180611 [details] [review] Goffice patch This patch introduces a new format syntax. There is no GUI support at the moment (and getting to that point will require goffice branching). For values like length, a format of ##0.00EEE+00"m" can be used. It'll produce 123.45nm or 12.35km The tripple-E is an extension of Excel's format. For values like weight, a format of ##0.00'EEE+00"g" can be used. A value of 1 will produce "1.00kg". The single quote is an extension that scales the input number up by 1000 in the same way that the existing (but buggy and locale dependent) comma scales it down by 1000. Multiple quotes or commas may be used as appropriate for units involving powers of "kg". The format ignores SI prefixes that are not a power of 10^3, e.g., "c". For exponents outside -24 to 24, this reverts to regular engineering notation. Slightly surprising is that this means that 1e50 will show as "100.00E50g" in the weight case. Most people would probably have preferred "100.00E48kg". This still leaves the open question of whether all this is a good idea.
I think we really should have the possibility to select markup and SI separately. While in the range of SI prefixes (and assuming engineering notation) they are indistinguishable, they differ for values outside the range. So I propose ESI and EESI respectively.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.