What is “size”?

When talking about concepts like ItemSize, ImageSize, FontSize, row/column height within a grid or any other size/scale functions, what units is Mathematica referring to? How are these related to the pixels on the default 100% notebook magnification?

The main reason I'm asking this is because I want to scale a program so that it fits any monitor it is rendered and displayed on. However, I don't really understand how size units are defined in Mathematica.

This must be naturally explained somewhere, but I couldn't find it and so any references are appreciated.

Answers 1

  • There is no universal unit in Mathematica. You will need to check the documentation for each size setting.

    Commonly used units include:

    • "Points" usually correspond to pixels on the screen (with Mathematica's default 72 dpi resolution) or printer's points in print. Examples: ImageSize, Offset coordinates, FontSize, etc.

      Sometimes, point sizes can be used in contexts where the default unit is something else through the Offset wrapper.

    • Plot coordinates use the coordinate system of graphics. This is how numbers are interpreted in graphics primitives. Some options, such as PlotRangePadding also use this.

    • Scaled sizes/coordinates are relative to some larger object, which may differ from case to case. Scaled is relative to the plot area when used in graphics. It is relative to the notebook width when used in the ImageSize of a Graphics. ImageScaled is relative to the figure size. And so on.

      In most cases, scaled sizes must be explicitly indicated with the Scaled (or ImageScaled) wrapper and can be used in contexts where the default unit is something different.

    • Units relative to the font size: this is often ems for widths and line height for heights. Examples: Spacings, ItemSize, etc. These are typically used in the context of Grid/Column/Row.

Related Questions