HorizontalLineDecorator

class qf_lib.plotting.decorators.line_decorators.HorizontalLineDecorator(y: (<class 'int'>, <class 'float'>, <class 'complex'>, <class 'bool'>, <class 'bytes'>, <class 'str'>, <class 'memoryview'>, <class 'numpy.bool_'>, <class 'numpy.complex64'>, <class 'numpy.complex128'>, <class 'numpy.clongdouble'>, <class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.longdouble'>, <class 'numpy.int8'>, <class 'numpy.int16'>, <class 'numpy.int32'>, <class 'numpy.longlong'>, <class 'numpy.int64'>, <class 'numpy.datetime64'>, <class 'numpy.timedelta64'>, <class 'numpy.object_'>, <class 'numpy.bytes_'>, <class 'numpy.str_'>, <class 'numpy.uint8'>, <class 'numpy.uint16'>, <class 'numpy.uint32'>, <class 'numpy.ulonglong'>, <class 'numpy.uint64'>, <class 'numpy.void'>), color: str = 'k', key: ~typing.Optional[str] = None, **plot_settings: ~typing.Any)[source]

Bases: ChartDecorator, SimpleLegendItem

A simple decorator that displays a horizontal line.

Constructs a new horizontal line decorator. The plot_settings are passed directly to matplotlib’s axhline. See http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.axhline for valid settings.

When plotting for the web, the plot_settings are passed directly to HighChart’s plotLines options.

Methods:

decorate(chart)

Modifies the axes object taken from the chart (e.g.

decorate_html(chart, chart_id)

Constructs code to decorate an existing web chart.

decorate(chart: Chart) None[source]

Modifies the axes object taken from the chart (e.g. adds legend, draws cone, etc.).

decorate_html(chart: Chart, chart_id: str) str[source]

Constructs code to decorate an existing web chart.

Parameters:
  • chart (Chart) –

  • chart_id (str) – A string identifying the specific chart. For the web, the <div> that represents this chart will typically use this as its id.

Returns:

JavaScript code that is called before the underlying chart is initialised. The code can modify the pre-defined options variable.

Return type:

str