Skip to content

power_balance.plotting.common#

Source: power_balance/plotting/common.py

add_plot_objects#

add_plot_objects(figure: <function figure at 0x7fe371db5b40>, x_array: numpy.ndarray, y_array: numpy.ndarray, x_label: str, y_label: str, point_threshold: int = 100) -> None
Source: power_balance/plotting/common.py

Create a Bokeh plot source

Parameters#

  • x_array: numpy.ndarray

    independent variable array

  • y_array: numpy.ndarray

    dependent variable array

  • x_label: str

    label for independent data array

  • y_label: str

    label for dependent data array

  • point_threshold: int, default 100

    threshold on number of data points to display, default is 100

make_hover_tool#

make_hover_tool(x_label: str, y_label: str, dec_places: int = 4) -> bokeh.models.tools.HoverTool
Source: power_balance/plotting/common.py

Create a HoverTool instance for a variable plot. This allows the interface user to hover over data points and see info.

Parameters#

  • x_label: str

    name of independent variable

  • y_label: str

    name of dependent variable

  • dec_places: int, default 4

    number of decimal places before the exponent, default is 4

Returns#

  • bokeh.models.tools.HoverTool

    instance of hover tool to be added to Bokeh plot

plot_to_image#

plot_to_image(x_array: Iterable, y_array: Iterable, x_label: str, y_label: str, file_name: str, dpi: int = 900, filetype: str = 'jpeg') -> None
Source: power_balance/plotting/common.py

Plots graph of power against time and saves to the given file address.

Parameters#

  • x_array: typing.Iterable

    x axis array

  • y_array: typing.Iterable

    y array

  • x_label: str

    independent variable label

  • y_label: str

    dependent variable label

  • file_name: str

    output file name (should match filetype)

  • dpi: int, default 900

    image resolution, by default 900

  • filetype: str, default jpeg

    file format, by default "jpeg"


Last update: April 1, 2022