pgf-tikz / pgfplots

pgfplots - A TeX package to draw normal and/or logarithmic plots directly in TeX in two and three dimensions with a user-friendly interface and pgfplotstable - a TeX package to round and format numerical tables. Examples in manuals and/or on web site.
http://pgfplots.sourceforge.net/
187 stars 33 forks source link

Units do not belong in [brackets] (\usepgfplotslibrary{units}) #444

Closed MartiBrown closed 1 year ago

MartiBrown commented 1 year ago

When using \usepgfplotslibrary{units} and specifying units they will be written in brackets [ ]. This seems to be a common misconception.

The idea is that a quantity is composed of a numerical value and a unit by multiplication. That is why we can calculate with units. That is also why a space is added between number and unit or why we write the speed as m/s (a division of units) The writing is as follows: Q = {Q} x [Q] Where Q is the Quantity, {Q} denotes the numerical value and [Q] the unit of Q example: F = 120 N Where {F} = 120 and [F] = N

Therefore it does not make sense to put units in brackets.

One can write {Q} = Q / [Q] to get the numerical value. That is a convenient form for figures and tables. Example: v / (m/s) or F / N

The division obviously does not make sense if one is writing Force as a word instead of the symbol F. In this case, the use if the wird "in" is best: Velocity in m/s or Force in N.

References: ISO 80000-1 Quantities and Units SI Brochure https://www.bipm.org/en/publications/si-brochure/ NIST Guide to SI section 7.1 https://www.nist.gov/pml/special-publication-811/nist-guide-si-chapter-7-rules-and-style-conventions-expressing-values Austrian Standards Fachinformation 23 https://www.austrian-standards.at/dokumente/produkte-loesungen/kostenlose-services/fachinformationen/23-groessen/FI23_Einheiten.pdf Rohde & Schwarz https://cdn.rohde-schwarz.com/pws/dl_downloads/dl_common_library/dl_brochures_and_datasheets/pdf_1/Normgerechter_Umgang_mit_Groessen_Einheiten_Gleichungen_bro_de_5214-5061-61_v0500.pdf DIN 461 Graphische Darstellung in Koordinatensystemen DIN 1313 Größen

hmenke commented 1 year ago
\pgfplotsset{unit marking pre={\mbox{in }},unit marking post={}}
MartiBrown commented 1 year ago

Thanks for the reply. Shoudn't the default behavior apply the convention i. e. devide by? I think this is the issue.

Also for combined units like m/s or N m one has to remeber to put them into parenthesis when using devide by. Example: v / (m/s) or M / (N m)

Of course the parenthesis are not necessary when using "in".

Mo-Gul commented 1 year ago

You are right, it would be much better to have unit markings=square brackets. This already was proposed years ago, but Christian decided that this would be a "breaking change" (see https://github.com/pgf-tikz/pgfplots/issues/54#issuecomment-586753403). Therefore, this is on the list for a potential v2 (beside other stuff of course).

To my knowledge one should either use "maths" or "text" as axis labels, i.e. either you write e.g. "v / (m/s)" or "velocity in m/s" but not e.g. "velocity / (m/s)" or "v in m/s".

ilayn commented 1 year ago

Not that I am against of using the standard but it is not adopted globally and brackets are very common to use. Note that graphing standards are for clarity. And having the units shown separate from the plot label is very convenient especially when you have long text and small letters for units. It gives the context much better in one look instead of the eye parsing for suitable spacing (x label positioning is another typical complaint that clutters the plots for example in the same group of standards). DIN 1333 is another story and handles the units inside text not in the plot label.