graphpkg package¶
Submodules¶
graphpkg.live_graph module¶
Devloped By : Nishant Baheti
A lot of things need to be added here. Will surely do.
-
class
graphpkg.live_graph.
LiveDashboard
(config: dict)[source]¶ Bases:
object
Live Dashboard plot
- Parameters
config (dict) – Configuration Dictionary
Notes
Dashboard Configration Example
conf = {“dashboard”: “DASHBOARD1”,“plots”: {“trend”: [{“func_for_data”: func1,“fig_spec”: (1,3,(1,2)),“interval”: 500,“title” : “trend plot1”}],“scatter”: [{“fig_spec” : (1, 3, 3),“func_for_data” : func3,“func_args”: (1000,),“interval” : 1000,“title” : “other scatter plot”,“window”: 500}]}}Example
>>> conf = { >>> "dashboard": "DASHBOARD1", >>> "plots": { >>> "trend": [ >>> { >>> "func_for_data": func1, >>> "fig_spec": (4, 3, (1, 2)), >>> "interval": 500, >>> "title": "trend plot1" >>> }, >>> { >>> "func_for_data": func1, >>> "fig_spec": (4, 3, (4, 5)), >>> "interval": 500, >>> "title": "trend plot2" >>> }, >>> { >>> "func_for_data": func1, >>> "fig_spec": (4, 3, (7, 8)), >>> "interval": 500, >>> "title": "trend plot3" >>> }, >>> { >>> "func_for_data": func1, >>> "fig_spec": (4, 3, (10,11)), >>> "interval": 500, >>> "title": "trend plot4" >>> } >>> ], >>> "distribution": [{ >>> "fig_spec": (4, 3, (3,6)), >>> "func_for_data": func4, >>> "interval": 1000, >>> "title": "distribution plot", >>> "window": 500 >>> }], >>> "scatter": [ >>> { >>> "fig_spec": (4, 3, (9,12)), >>> "func_for_data": func3, >>> "func_args": (1000,), >>> "interval": 1000, >>> "title": "other other scatter plot", >>> "window": 500 >>> } >>> ] >>> } >>> } >>> dash = LiveDashboard(config=conf) >>> dash.start() >>> matplotlib.pyplot.show()
-
class
graphpkg.live_graph.
LiveDistribution
(interval: int, func_for_data: callable, func_args: Optional[Iterable] = None, fig: Optional[matplotlib.pyplot.figure] = None, fig_spec: tuple = (1, 1, 1), xlabel: str = 'x-axis', ylabel: str = 'y-axis', label: str = 'Current Data', title: str = 'Live Scatter', window: int = 2000)[source]¶ Bases:
object
Live Distribution Graph Module
- Parameters
func_for_data (callable) – Function to return x and y data point.x is a single value and y can be a list of max length 3 or a single value. both of them shouldn’t be None.
Example –
>>> def get_new_data(): >>> return 10,10
>>> def get_new_data(): >>> ## first param for x axis and second can be an array of values >>> return 10,[10,11]
>>> def func1(*args): >>> return random.randrange(1, args[0]),random.randrange(1, args[0])
func_args (Iterable, optional) – data function arguments. Defaults to None.
fig (matplotlib.pyplot.figure, optional) – [description]. Defaults to None.
fig_spec (tuple, optional) – [description]. Defaults to (1,1,1).
interval (int) – Interval to refresh data in milliseconds.
xlabel (str, optional) – Label for x-axis. Defaults to “x-axis”.
ylabel (str, optional) – Label for y-axis. Defaults to “y-axis”.
label (str, optional) – Label for plot line. Defaults to “Current Data”.
title (str, optional) – Title of Scatter chart. Defaults to “Live Scatter”.
window (int, optional) – Data point window. Defaults to 500.
Examples
>>> x
-
class
graphpkg.live_graph.
LiveScatter
(interval: int, func_for_data: callable, func_args: Optional[Iterable] = None, fig: Optional[matplotlib.pyplot.figure] = None, fig_spec: tuple = (1, 1, 1), xlabel: str = 'x-axis', ylabel: str = 'y-axis', label: str = 'Current Data', title: str = 'Live Scatter', window: int = 500)[source]¶ Bases:
object
Live Scatter Graph Module
- Parameters
func_for_data (callable) – Function to return x and y data point.x is a single value and y can be a list of max length 3 or a single value. both of them shouldn’t be None.
Example –
>>> def get_new_data(): >>> return 10,10
>>> def get_new_data(): >>> ## first param for x axis and second can be an array of values >>> return 10,[10,11]
>>> def func1(*args): >>> return random.randrange(1, args[0]),random.randrange(1, args[0])
func_args (Iterable, optional) – data function arguments. Defaults to None.
fig (matplotlib.pyplot.figure, optional) – [description]. Defaults to None.
fig_spec (tuple, optional) – [description]. Defaults to (1,1,1).
interval (int) – Interval to refresh data in milliseconds.
xlabel (str, optional) – Label for x-axis. Defaults to “x-axis”.
ylabel (str, optional) – Label for y-axis. Defaults to “y-axis”.
label (str, optional) – Label for plot line. Defaults to “Current Data”.
title (str, optional) – Title of Scatter chart. Defaults to “Live Scatter”.
window (int, optional) – Data point window. Defaults to 500.
Examples
>>> scatter = LiveScatter(func_for_data = get_new_data, interval=1000) >>> scatter.start() >>> matplotlib.pyplot.show()
>>> scatter = LiveScatter(func_for_data = get_new_data, interval=1000, window=30) >>> scatter.start() >>> matplotlib.pyplot.show()
>>> scatter = LiveScatter(func_for_data = get_new_data,func_args=(1000,), interval=1000, title="my test data") >>> scatter.start() >>> matplotlib.pyplot.show()
-
class
graphpkg.live_graph.
LiveTrend
(interval: int, func_for_data: callable, func_args: Optional[Iterable] = None, fig: Optional[matplotlib.pyplot.figure] = None, fig_spec: tuple = (1, 2, (1, 2)), xlabel: str = 'x-axis', ylabel: str = 'y-axis', label: str = 'Current Data', title: str = 'Live Trend', window: int = 50)[source]¶ Bases:
object
Live Trend Graph Module
- Parameters
func_for_data (callable) – Function to return x and y data points.x is a single value and y can be a list of max length 3 or a single value.
Example –
>>> def get_new_data(): >>> return datetime.datetime.now(),10
>>> def get_new_data(): >>> return None,10
>>> def get_new_data(): >>> ## first param for x axis and second can be an array of values >>> return datetime.datetime.now(),[10,11]
>>> def func1(*args): >>> return datetime.datetime.now(),random.randrange(1, args[0])
func_args (Iterable, optional) – data function arguments. Defaults to None.
fig (matplotlib.pyplot.figure, optional) – [description]. Defaults to None.
fig_spec (tuple, optional) – [description]. Defaults to (1,1,1).
interval (int) – Interval to refresh data in milliseconds.
xlabel (str, optional) – Label for x-axis. Defaults to “x-axis”.
ylabel (str, optional) – Label for y-axis. Defaults to “y-axis”.
label (str, optional) – Label for plot line. Defaults to “Current Data”.
title (str, optional) – Title of trend chart. Defaults to “Live Trend”.
window (int, optional) – Data point window. Defaults to 50.
Examples
>>> trend = LiveTrend(func_for_data = get_new_data, interval=1000) >>> trend.start() >>> matplotlib.pyplot.show()
>>> trend = LiveTrend(func_for_data = get_new_data, interval=1000, window=30) >>> trend.start() >>> matplotlib.pyplot.show()
>>> trend = LiveTrend(func_for_data = get_new_data, interval=1000, title="my test data") >>> trend.start() >>> matplotlib.pyplot.show()