Skip to content

add support for _custom style_ in `plot.py`

STEVAN Antoine requested to merge plot-script into main

💡 Note

  • in the following examples, any part of the $.style specification is optional and can either be ommitted or set to null
  • the default values for $.style are given in plot.py --help
let xs = seq 0 5 | each { 2 ** $in } | wrap x
let twice = $xs | insert measurement { 2 * $in.x } | insert error { 0.1 + 0.5 * $in.x }
let square = $xs | insert measurement { $in.x ** 2 } | insert error { 1 + 1.5 * $in.x }

and try

python scripts/plot/plot.py --title title --x-label x --y-label y --fullscreen ([
    { group: "x ^ 2", items: $square },
    { group: "2 * x", items: $twice }
] | to json)

vs

python scripts/plot/plot.py --title title --x-label x --y-label y --fullscreen ([
    {
        group: "x ^ 2",
        items: $square,
        style: {
            color: "red",
            alpha: 0.5,
            line: {
                marker: 's',
                width: 2,
                type: "dashed",
            },
        }
    },
    {
        group: "2 * x",
        items: $twice,
        style: {
            color: "purple",
            alpha: 0.1,
            line: {
                marker: 'o',
                width: 5,
                type: "dotted",
            },
        }
    }
] | to json)

Merge request reports