Plot

Format

Format numbers, dates, text, and null values in table cells.

The format file consists of a newline separated list of formatting instructions controlling the cell number/text/date formatting.

TODO: EXPLAIN DEFAULT BEHAVIOR

The novem platform supports a wider variety of number formatting rules, we actually support the entire python format mini-language. Number formatting works very similar to other novem formatting instructions, just slice out the part of the table you want to operate on and specify the formatting.

ctrl/config/table/cell/format
 1:-1  1:     ,.1% -- format everything except
                   -- first row and first column as pct
-1     1:     ,.1% -- format last row as pct (skip first column)

Novem extends the standard python library with basic support for scientific notation by using the s suffix.

This supports a single integer precision before the s keyword

ctrl/config/table/cell/format
 1:-1  1:     1s -- format everything except
                   -- first row and first column as pct
-1     1:     5s -- format last row as pct (skip first column)

We further expand the standard formatting by offering a convenient "money" format with the m suffix.

In addition to the precision integer of s, m also offer an optional currency symbol between the precision and the m.

ctrl/config/table/cell/format
 :    0         m   -- just m, defaults to precision of 1
 :    1       .2m   -- a double precision monetary value
 :    2      $.3m   -- add a usd `$` prefix
 :    3      .4m$   -- add a usd `$` suffix

for details see the python format mini-language

Novem tables support markdown formatting in cells. This is particularly useful for adding emphasis, superscripts, or line breaks within cells.

 **text**   -- bold
 *text*     -- italic
 ^text^     -- superscript

To create line breaks within a cell (useful for multi-line headers), you can use:

  • Double newline (\n\n) - creates a line break
  • Two spaces + newline ( \n) - standard markdown hard break

This is especially handy for long column headers that you want to split across multiple lines:

# Example: Multi-line header using double newline
plt.data = """
"Revenue\n\n(USD)","Growth\n\nRate","Year over\n\nYear"
1000,5.2%,+2.1%
2000,3.8%,-1.4%
"""

The headers will render as:

Revenue     Growth      Year over
(USD)       Rate        Year

To explicitly enable markdown rendering, use the md format instruction:

ctrl/config/table/cell/format
0   :   md   -- enable markdown for header row

Note: Markdown is also used as a fallback when numeric formats cannot parse a cell value, so text cells with markdown formatting will typically render correctly without explicit configuration.

By default, null/missing values in tables are rendered as invisible whitespace. You can customize how null values are displayed by adding an optional na_rep token after the format type.

Syntax:

row_slice col_slice format_type [na_rep]

Examples:

ctrl/config/table/cell/format
:   :   $.2m  N/A    -- money format, nulls show "N/A"
:   2   %m/%d -      -- date format, nulls show "-"
0   1   st    #N/A   -- static text, nulls show "#N/A"

Blank convention:

To explicitly show invisible whitespace (the default behavior), use:

  • _ - invisible whitespace
  • blank or BLANK - same as _ (case-insensitive)
ctrl/config/table/cell/format
:   :   .2f   _      -- float format, nulls show blank (explicit)
:   :   st    blank  -- static text, nulls show blank (explicit)

Any other string is used literally as the null value display text.