Base plotting library for stock plotters

This library does not use any other libraries.

The code for this algorithm in Python
The ruler at 80 columns indicate suggested POSIX line breaks (for readability).
The editor will automatically enlarge to accomodate the entirety of your input
Use keyboard shortcuts for search/replace and faster editing. For example, use Ctrl-F (PC) or Cmd-F (Mac) to search through this box

Base plotting library containing common code for executing plots.

Usage

You must include this library so that your plotter can become an inherited type of the Plotter declared here:

class Plotter(baselib.Plotter):

  def __init__(self):

    super(Plotter, self).__init__()


  def setup(self, parameters):

    super(Plotter, self).setup(parameters)

    # setup other parameters, fix things


  def process(self, inputs):

    fig, ax = super(Plotter, self).prepare_canvas()

    # write here your plotting code

    super(Plotter, self).apply_parameters(ax)

    # you may override here plotting parameters applied by the base class

    return super(Plotter, self).encode_figure(fig)

Your plotter must then be declared as follows (so that all parameters are taken into account):

{
  "dataformat": "plot/<format>/1",
  "language": "python",
  "uses": {
    "baselib": "plot/baselib/1",
  },
  "description": "Whatever it should be",
  "multiple": true,
  "parameters": {
    "xlabel": {
      "default": "X",
      "type": "string",
      "description": "The label of the X-axis (horizontal)"
    },
    "ylabel": {
      "default": "Y",
      "type": "string",
      "description": "The label of the Y-axis (vertical)"
    },
    "title": {
      "default": "Scatter plot",
      "type": "string",
      "description": "The title for this plot"
    },
    "xaxis_multiplier": {
      "default": "1.0",
      "type": "float64",
      "description": "The multiplication factor for the X-axis (horizontal)"
    },
    "yaxis_multiplier": {
      "default": "1.0",
      "type": "float64",
      "description": "The multiplication factor for the Y-axis (vertical)"
    },
    "legend": {
      "default": "",
      "type": "string",
      "description": "Short description of the data, to be added to the plot"
    },
    "grid": {
      "default": false,
      "type": "bool",
      "description": "If we should draw grid lines or not for the plot"
    },
    "xaxis_log": {
      "default": false,
      "type": "bool",
      "description": "If X-axis (horizontal) should be in log-scale"
    },
    "yaxis_log": {
      "default": false,
      "type": "bool",
      "description": "If Y-axis (vertical) should be in log-scale"
    },
    "dpi": {
      "default": 60,
      "type": "uint16",
      "description": "Dots-per-inch in raster image formats"
    },
    "width": {
      "default": 400,
      "type": "uint16",
      "description": "Width of the resulting image in pixels"
    },
    "height": {
      "default": 300,
      "type": "uint16",
      "description": "Height of the resulting image in pixels"
    },
    "content_type": {
      "default": "image/png",
      "description": "The type of image returned",
      "type": "string",
      "choice": [
        "image/png",
        "image/jpeg",
        "application/pdf"
      ]
    }
  }
}
No referrer objects found.
No referrer algorithms found.
Terms of Service | Contact Information | BEAT platform version 1.3.1rc1 | © Idiap Research Institute - 2013-2019