automata4cps.vis

The module provides methods to visualize various kinds of data, such as time series or automata graphs.

Authors: - Nemanja Hranisavljevic, hranisan@hsu-hh.de, nemanja@ai4cps.com - Tom Westermann, tom.westermann@hsu-hh.de, tom@ai4cps.com

automata4cps.vis.plot_bipartite_graph(network)

Plots a bipartite graph of a network graph. :param network: networkx network or a bi-adjacency matrix. :return:

automata4cps.vis.plot_cps(cps: CPS, node_labels=False, edge_labels=True, node_size=40, node_font_size=20, edge_font_size=16, edge_text_max_width=None, output='cyto', dash_port=8050, **kwargs)

Plots all the components of a CPS in the same figure. :param cps: CPS to plot. :param node_labels: Should node labels be plotted. :param edge_labels: Should edge labels be plotted. :param node_size: What is the size of the nodes in the figure. :param node_font_size: The font size of the node labels. :param edge_font_size: The font size of the edge labels. :param edge_text_max_width: Max width of the edge labels. :param output: Should output be plotted as a dash.Cytoscape component (“cyto”), or should dash server be run (“dash”). :param dash_port: If temporary dash server is run, what port to use. :param kwargs: Other paramters are forwarded to the Cytoscape component. :return:

automata4cps.vis.plot_cps_component(cps, id=None, node_labels=False, edge_labels=True, edge_font_size=6, edge_text_max_width=None, output='cyto')
Parameters:
  • cps

  • id

  • node_labels

  • edge_labels

  • edge_font_size

  • edge_text_max_width

  • output

Returns:

automata4cps.vis.plot_cps_plotly(cps, layout='dot', marker_size=20, node_positions=None, show_events=True, show_num_occur=False, show_state_label=True, font_size=10, plot_self_transitions=True, use_previos_node_positions=False, **kwargs)
Parameters:
  • cps

  • layout

  • marker_size

  • node_positions

  • show_events

  • show_num_occur

  • show_state_label

  • font_size

  • plot_self_transitions

  • use_previos_node_positions

  • kwargs

Returns:

automata4cps.vis.plot_execution_tree(graph, nodes_to_color, color, font_size=30)
automata4cps.vis.plot_state_transitions(self, state, obs=None)
automata4cps.vis.plot_stateflow(stateflow, color_mapping=None, state_col='State', bar_height=12, start_column='Start', finish_column='Finish', return_figure=False, description_col='Description', idle_states=None)
automata4cps.vis.plot_timeseries(data, title=None, timestamp=None, use_columns=None, discrete=False, height=None, plotStates=False, limit_num_points=None, names=None, xaxis_title=None, customdata=None, iterate_colors=True, y_title_font_size=14, opacity=1, vertical_spacing=0.005, sharey=False, bounds=None, plot_only_changes=False, yAxisLabelOffset=False, marker_size=4, showlegend=False, mode='lines+markers', **kwargs)

Using plotly library, plots each variable (column) in a collection of dataframe as subplots, one after another.

Arguments: plotStates (bool): if True, changes interpolation to ‘hv’, therefore keeping the last value yAxisLabelOffset (bool): if True, adds an offset to the plots y-axis labels. Improves readability on long subplot names.

Return type:

fig (plotly.Figure)

automata4cps.vis.plot_transition(self, s, d)
automata4cps.vis.view_graphviz(self, layout='dot', marker_size=20, node_positions=None, show_events=True, show_num_occur=False, show_state_label=True, font_size=10, plot_self_transitions=True, use_previos_node_positions=False, **kwargs)

Classes