https://raw.githubusercontent.com/MatthewReid854/reliability/master/docs/images/logo.png

crosshairs

class reliability.Other_functions.crosshairs(xlabel=None, ylabel=None, decimals=2, dateformat=None, **kwargs)

Adds interactive crosshairs to matplotlib plots

Parameters:
  • xlabel (str, optional) – The xlabel for annotations. Default is ‘x’.

  • ylabel (str, optional) – The ylabel for annotations. Default is ‘y’.

  • decimals (int, optional) – The number of decimals for rounding. Default is 2.

  • dateformat (str, optional) – The datetime format. If specified the x crosshair and label will be formatted as a date using the format provided. Default is None which results in no date format being used on x.

  • kwargs (optional) – plotting kwargs to change the style of the crosshairs (eg. color, linestyle, etc.).

Returns:

None

Notes

Ensure this is used after you plot everything as anything plotted after crosshairs() is called will not be recognised by the snap-to feature. For a list of acceptable dateformat strings see https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes