Runtime Configuration

The scipp Python module supports several configuration options which may be set based on preference. Most of these are related to layout of items in Jupyter Notebooks and plotting.

The location of the configuration file varies between operating systems. To determine where it is located on a particular installation the following Python may be used:

[1]:
import scipp as sc
print(sc.user_configuration_filename)
/home/vsts/.config/scipp/config.yaml

When the scipp module is imported and no configuration file exists a default one is created. If a configuration file already exists it will not be modified, i.e. new options will not automatically be added to it when Scipp is updated.

Values may be set via Python as follows:

[2]:
print('Old value:', sc.config.plot.width)
sc.config.update({'plot.width': 300})
print('New value:', sc.config.plot.width)
Old value: 600
New value: 300

Note that changes made via the Python API are not persisted in the configuration file. Permanent changes must be made to the file directly.

Warning

The fields in the configuration file are not strictly defined and may vary between Scipp versions. For this reason it is advised to browse this file to determine what options are available.

List of configuration options

config.plot

  • color: The list of default line colors for one-dimensional plots. When multiple lines are on the same plot, the first line will use the first color, the second line will use the second color, and so on.

  • params: The colorbar properties.

    • params.cmap: The matplotlib colormap.

    • params.norm: The normalization for y values (1d plots) or color values (2+d plots).

      • Default: "linear".

      • Allowed: "linear" or "log".

    • params.vmin: Set the minimum value for the y-axis (1d plots) or the colorbar (2+d plots).

      • Default: None.

      • Allowed: A numeric value.

    • params.vmax: Set the maximum value for the y-axis (1d plots) or the colorbar (2+d plots).

      • Default: None.

      • Allowed: A numeric value.

    • params.color: The default line color. If None, a value will be chosen from the config.plot.color list above.

      • Default: None.

      • Allowed: A html color code or name.

    • params.cbar: Show the colorbar if True.

      • Default: True.

      • Allowed: True or False.

    • params.nan_color: The colormap color for NaN values.

      • Default: "#d3d3d3".

      • Allowed: A html color code or name.

    • params.under_color: The colormap color for underflow values.

      • Default: "#9467bd".

      • Allowed: A html color code or name.

    • params.over_color: The colormap color for underflow values.

      • Default: "#8c564b".

      • Allowed: A html color code or name.

  • height: The figure height (in pixels).

    • Default: 467.

    • Allowed: An integer number > 0.

  • width: The figure width (in pixels).

    • Default: 700.

    • Allowed: An integer number > 0.

  • dpi: The figure resolution.

    • Default: 96.

    • Allower: An integer number > 0.

  • aspect: Aspect ratio for images: "equal" will conserve the aspect ratio, while "auto" will stretch the image to the size of the figure.

    • Default: "auto".

    • Allowed: "auto" or "equal".

  • marker: List of matplotlib line markers. When multiple lines are on the same plot, the first line will use the first marker, the second line will use the second marker, and so on.

  • linewidth: Line widths for one-dimensional plots.

    • Default: [1.5].

    • Allowed: A list of integers or floats.

  • linestyle: Line styles for one-dimensional histogram plots.

  • padding: Padding around figure axes.

    • Default: [0.05, 0.02, 1, 1].

    • Allowed: A list of 4 numbers representing the left, bottom, right, and top edges, respectively.

  • pixel_ratio: Monitor pixel ratio (see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio). This affects the size of the points in three-dimensional plots. Set to > 1 for high density (e.g. retina) displays

    • Default: 1.0.

    • Allowed: A numeric value.

config.colors:

The color scheme for the scipp.table and scipp.show functions, and the control buttons around the plots.

  • attrs: Color for attributes.

    • Default: "#ff5555".

    • Allowed: A html color code or name.

  • coords: Color for coordinates.

    • Default: "#c6e590".

    • Allowed: A html color code or name.

  • data: Color for data.

    • Default: "#f6d028".

    • Allowed: A html color code or name.

  • masks: Color for masks.

    • Default: "#c8c8c8".

    • Allowed: A html color code or name.

  • hover: Color for hovering on table rows.

    • Default: "#d6eaf8".

    • Allowed: A html color code or name.

  • header_text: Color for table header text.

    • Default: "#111111".

    • Allowed: A html color code or name.

  • button: Color for plot control button.

    • Default: "#bdbdbd49".

    • Allowed: A html color code or name.

  • button_selected: Color for selected plot control button.

    • Default: "#bdbdbdbb".

    • Allowed: A html color code or name.

Other

  • config.table_max_size: The maximum number of rows to display in tables generated by sc.table().

    • Default: 50.

    • Allowed: An integer > 1.