Skip to main content

Export Plot configuration: JSON Format

We use matplotlib v3.1.3 for our plot generation. The plot report is configured using JSON. The top level global applies global configuration. It currently supports a limited subset of the rcParams: font_size, font_family, agg_path_chunksize. Future versions will support all rcParams keys. The global["plot_options"] can be used to configure plot options for all series. This is convenient if you want to apply an option to all series without having to define it for each one.

plot_options can also be defined at the plots level, which will apply to each series within a plot, or at the series level, which will apply to a specific series. All plot_options (global, plot, and series) are merged together when plotting each series, with the series plot_options having the highest precedence, then plot, then global. The plot_options at any level supports all matplotlib Line2D properties.

You may define the height_ratio as part of the plot object to control how much vertical space it takes up. Defaults to a value of 1.

Any option may be omitted entirely and a default value will be used.

Below is an example JSON plot config file. Note that pages and plots are JSON arrays which implies the generated pages and plots are ordered accordingly.

{
  "global": {
      "plot_options": {
        "linewidth": 0.3,
        "marker": "d",
        "markersize": 3
      },
      "font_size" : 10,
      "font_family" : "monospace",
      "agg_path_chunksize": 10000
  },
  "pages": [
    {
      "plots": [
        {
          "title": "1st plot on page 1",
          "series": [
              { 
                  "mnemonic": "oci.dau.boxrack.power.PS01.m1curoutp",
                  "plot_options": {"marker": "x"}
              }
          ],
          "plot_options": { "color": "red" },
          "y_min": -5,
          "y_max": 5
        }
      ]
    },
    {
      "plots": [
        {
          "title": "2 plots on page 2",
          "height_ratio": 2,
          "series": [
            {
              "mnemonic": "oci.dau.dauc.Tlm.Red_BdTemp3",
              "plot_options": {
                "color": "r"
              }
            },
            {
              "mnemonic": "oci.dau.dauc.Tlm.Blue_BdTemp3",
              "plot_options": {
                "color": "b"
              }
            }
          ]
        },
        {
          "height_ratio": 1,
          "series": [
            {
              "mnemonic": "oci.dau.ddc.FPGA.CcdOpMode",
              "plot_options": {
                "color": "k"
              }
            }
          ]
        }
      ]
    }
  ]
}