Tutorials › Pharmacometric Workflows and Reproducible Modeling › Labeling Units, Transformations, and Scales

Automating Diagnostics and Reports · Tutorial 304 of 399

Labeling Units, Transformations, and Scales

Build axis labels from the variable, its units, any transformation, and the plotting scale so readers can interpret diagnostic plots on their own.

Intermediate 10 min read

What You'll Learn

  • Identify the information needed to label a plotted variable outside its original context.
  • Distinguish plotting raw measurements on a logarithmic scale from plotting transformed values.
  • Write logarithmic transformations using dimensionless ratios and an explicit reference quantity.
  • Generate consistent labels for time, concentration, residual, and dose axes.
  • Detect labels that conceal unit conversions, invalid log inputs, or ambiguous scales.

Why Axis Labels Need More Than a Variable Name

A diagnostic plot may be technically correct and still be hard to interpret when it is viewed outside the analysis that produced it. A label such as “Concentration” does not say whether the values are measured in mg/L or µg/L, whether they have been transformed, or whether equal distances on the axis represent equal differences or equal ratios. Those distinctions matter when plots are exported, combined, or reviewed without the plotting code at hand.

A reliable label states what quantity is plotted, the unit of that quantity when it has one, and any transformation or scale needed to interpret the axis. The label should describe the values a reader sees on the ticks—not merely the name of a column in a data set. For example, raw concentrations displayed on a logarithmic axis and log-transformed concentrations displayed on a linear axis are different plotting choices and call for different labels.

Definition: An axis label is a compact description of the plotted quantity and the information necessary to interpret its tick values. For a measurement axis, that information generally includes the quantity name and unit. If the plotted values have been transformed, the label identifies the transformation and any reference quantity required to define it. If a nonlinear axis scale is used, the label or an immediately adjacent annotation makes that scale clear.

Separate the Quantity, Transformation, and Display Scale

When creating a label automatically, treat three choices separately. First identify the underlying quantity and its measurement unit. Next identify whether the plotted values are unchanged or transformed. Finally record whether the plotting scale is linear or nonlinear. Keeping these fields distinct prevents a common ambiguity: the word “log” might refer either to a mathematical transformation applied to the data or to the way the axis positions are laid out.

What is plotted?Axis scaleExample label
Concentration in mg/LLinearConcentration (mg/L)
Concentration in mg/LLogarithmic, with raw-value ticksConcentration (mg/L; log10 scale)
Log-transformed, dimensionless concentration ratioLinearlog10(Concentration / 1 mg/L)
Time in hoursLinearTime after dose (h)

For a linear axis, equal distances correspond to equal additive changes in the plotted quantity. A time axis from 0 to 24 h, for instance, places 1 h intervals at equal distances. On a logarithmic axis, equal distances correspond to equal multiplicative changes in positive values. A log10 axis places 0.1, 1, and 10 at equally spaced positions, even though the arithmetic differences between those values are not equal.

A logarithm is defined for a dimensionless number, not for a measurement with units. Therefore, if the plotted values themselves are log-transformed, define the transformation as a ratio to a reference quantity with the same units. For concentration \(C_i\), choose a positive reference concentration \(C_0\) and use \(\log_{10}(C_i/C_0)\). The ratio is dimensionless, so its logarithm is defined. State the reference in the label or in a clear adjacent note; otherwise the transformed values are not fully specified.

$$ z_i = \log_{10}\left(\frac{C_i}{C_0}\right) $$

The reference also clarifies how to read differences on a log10 scale. The difference between two transformed concentrations is

$$ \log_{10}\left(\frac{C_2}{C_0}\right)- \log_{10}\left(\frac{C_1}{C_0}\right) = \log_{10}\left(\frac{C_2}{C_1}\right) $$

Thus a one-unit increase in the transformed value corresponds to a tenfold increase in concentration, regardless of the chosen common reference. The reference affects the numerical origin but not the difference. On a raw-concentration logarithmic display, axis positions are proportional, up to an additive offset, to \(\log_{10}(C_i/C_0)\). The displayed ticks may still be labeled with raw concentrations and their units.

Worked Examples: From Plot Choices to Labels

Worked Example: Raw Concentration on a Logarithmic Axis

Suppose a hypothetical concentration-time diagnostic plots observed concentrations \(C\) in mg/L against time after dose in hours. The concentration axis uses a base-10 logarithmic scale, but its tick labels show raw concentrations: 0.1, 1, and 10 mg/L. Generate labels and explain the spacing.

The time values are unchanged and displayed linearly, so the horizontal label is Time after dose (h). The vertical values are raw concentrations with units, displayed logarithmically, so a clear label is Concentration (mg/L; log10 scale). This says that the tick values are concentrations, not log-transformed numbers.

To check the scale description, take \(C_0=1\) mg/L. The relative positions associated with the three positive concentrations are proportional, up to an additive offset, to the logarithms of their dimensionless ratios:

$$ \log_{10}\left(\frac{0.1\ \mathrm{mg/L}}{1\ \mathrm{mg/L}}\right)=-1,\qquad \log_{10}\left(\frac{1\ \mathrm{mg/L}}{1\ \mathrm{mg/L}}\right)=0,\qquad \log_{10}\left(\frac{10\ \mathrm{mg/L}}{1\ \mathrm{mg/L}}\right)=1 $$

The adjacent positions are each one log10 unit apart, so 0.1, 1, and 10 mg/L appear equally spaced. Their equal spacing does not mean they differ by equal additive amounts: the changes are 0.9 mg/L and 9 mg/L. Rather, each step is a tenfold change. The positive values and log scale are appropriate; zero would not have a finite logarithmic position.

Worked Example: Plotting a Transformed Concentration

A hypothetical analysis computes \(z=\log_{10}(C/C_0)\) using \(C_0=1\) mg/L, then plots \(z\) against time on linear axes. For concentrations \(0.2\), \(2\), and \(20\) mg/L, calculate the transformed values and write the vertical label.

For \(C=0.2\) mg/L, the ratio is \((0.2\ \mathrm{mg/L})/(1\ \mathrm{mg/L})=0.2\), so \(z=\log_{10}(0.2)\approx-0.6990\). For \(C=2\) mg/L, the ratio is 2 and \(z=\log_{10}(2)\approx0.3010\). For \(C=20\) mg/L, the ratio is 20 and \(z=\log_{10}(20)\approx1.301\). The units cancel in each ratio, and the three plotted transformed values are dimensionless.

Because the transformation is applied to the data and the resulting \(z\) values are shown on a linear axis, a suitable vertical label is log10(Concentration / 1 mg/L). The horizontal label remains Time after dose (h) if time is untransformed and measured in hours. Labeling the vertical axis simply “Concentration (mg/L; log10 scale)” would be misleading here: its ticks are transformed values, not raw concentrations on a log-spaced display.

The arithmetic also shows how to interpret a one-unit difference. The transformed values for 2 and 20 mg/L differ by \(1.301-0.3010=1.000\), corresponding to the concentration ratio \(20/2=10\). Thus a one-unit difference in \(z\) represents a tenfold concentration ratio.

Worked Example: Converting Units Before Labeling

A hypothetical plotting workflow converts time recorded in minutes to hours, then displays it linearly against an untransformed concentration in µg/L. The recorded times are 30, 90, and 180 min. Give the converted values and labels, and explain what should be recorded in the plotting metadata.

Since \(1\) h equals \(60\) min, divide each recorded time by 60: \(30/60=0.500\) h, \(90/60=1.50\) h, and \(180/60=3.00\) h. The horizontal label should name the plotted unit, not the input unit: Time after dose (h). The concentration has not been transformed and is measured in µg/L, so the vertical label is Concentration (µg/L).

The workflow should retain the conversion rule \(t_{\mathrm{h}}=t_{\mathrm{min}}/60\) alongside the quantity name and output unit. If the plot instead displayed the original time values, the label would need to be Time after dose (min). A label that says hours while plotting minutes changes the implied interpretation of every tick by a factor of 60.

This example illustrates a useful check: compare the unit in the label with the unit of the actual plotted vector after all conversions. The label should not be generated solely from the original data-column name or source-unit field.

A Reproducible Labeling Workflow

A small, explicit set of metadata fields can make labels consistent across diagnostic plots. For each axis, record the quantity name, unit, any unit conversion, transformation, logarithm base where relevant, reference quantity for a logarithmic transformation, and display scale. Then construct the label from those fields and check it against the plotted values. This workflow does not decide which plot or scale is scientifically appropriate; it makes the chosen representation legible.

1
Name the plotted quantity.
Use a meaningful name such as time after dose, observed concentration, or prediction error, rather than an unexplained variable name.
2
Verify the plotted unit.
Check whether values were converted, and use the output unit of the plotted vector. For dimensionless quantities, do not invent a measurement unit.
3
Describe any data transformation.
If values are transformed, state the transformation and its reference where needed. A logarithm of a measurement should be defined through a dimensionless ratio.
4
Record the display scale.
Distinguish raw values shown on a logarithmic axis from transformed values shown on a linear axis. State the log base when it is not otherwise clear.
5
Compare the label to the ticks.
Confirm that tick values and their spacing match the stated quantity, unit, transformation, and scale.

The checks in the final step are important because the label itself cannot repair an unsuitable representation. A logarithmic display requires positive values. If a variable includes zero or negative values, those observations cannot be placed on an ordinary logarithmic axis; silently dropping them would change the plotted data. The analyst must instead choose and document a defensible alternative, such as a linear scale, or a different transformation appropriate to the measurement and analysis.

Diagnostics, Alternatives, and Limitations

Several practical comparisons help diagnose labeling problems. On a linear axis, raw values retain their units and equal distances encode equal additive differences. On a logarithmic display of raw positive values, ticks can retain the original unit, but equal distances encode equal ratios. On a linear axis of transformed values, ticks encode differences in the transformed quantity; the transformation and reference must therefore be visible. These approaches can produce visually similar patterns while giving the axes different meanings.

A label such as “log concentration” is often inadequate. It does not identify the logarithm base, does not say whether the data were transformed or the display axis was logarithmic, and may imply a logarithm of a dimensional quantity. Prefer an explicit form such as log10(Concentration / 1 mg/L) for transformed values, or Concentration (mg/L; log10 scale) for raw concentrations on a log10 display.

  • Tick-label check: If ticks show 0.1, 1, and 10 mg/L at equal intervals, confirm the label identifies raw concentration on a log scale.
  • Unit check: If the source values were converted, verify the label uses the converted unit and the tick values agree.
  • Transformation check: If the plotted vector contains log-transformed values, verify the label gives the transform and reference rather than presenting those values as raw measurements.
  • Domain check: For an ordinary logarithmic axis, confirm every plotted value is positive and that no zero or negative observations were omitted without explanation.
  • Export check: Inspect the rendered plot at its final size. A technically complete label can still be unreadable if units, parentheses, or a scale note are clipped or too small.

A common mistake is to put “log scale” on the label whenever the word “log” appears in the analysis. That is wrong if the data were first transformed and the transformed values are plotted linearly: in that case the scale is linear, and the transformation belongs in the quantity label. The correction is to describe the data transformation and display scale as separate properties.

Labels also have limits. They cannot communicate every analysis choice, such as how observations were selected or how a prediction was computed, and excessive detail can make a plot difficult to read. Keep the axis label concise but complete for the plotted quantity; put additional context where it can be seen with the figure. A label should support independent interpretation, not substitute for a clear analysis record.

Key takeaway: Generate axis labels from the values actually plotted. State the quantity and its plotted unit, identify data transformations with any necessary reference, and distinguish those transformations from the linear or logarithmic display scale.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A plot shows raw concentrations in mg/L at ticks 0.01, 0.1, 1, and 10 on equal-spaced positions. Give an appropriate vertical label and state what equal spacing represents.
  2. Why is \(\log_{10}(C)\) incomplete when \(C\) is a concentration with units? Write a defined form using a reference concentration.
  3. A data vector contains \(z=\log_{10}(C/(1\ \mathrm{mg/L}))\), plotted on a linear axis. Should the label say “Concentration (mg/L; log10 scale)” or name the transformed quantity? Explain.
  4. Time is stored in minutes, converted by division by 60, and plotted in hours. What unit belongs in the axis label, and what numerical value results from 150 min?

Solutions. (1) Use Concentration (mg/L; log10 scale). Equal spacing represents equal multiplicative changes: each adjacent tick is a tenfold increase, not an equal additive increase. (2) A logarithm requires a dimensionless argument; write \(\log_{10}(C/C_0)\), for example with \(C_0=1\) mg/L. (3) Name the transformed quantity, for example log10(Concentration / 1 mg/L), because the plotted ticks are transformed values on a linear scale, not raw concentrations on a logarithmic display. (4) Label the axis in hours; \(150/60=2.50\) h.

Clinical Biostats