pm4py.vis module#
The pm4py.vis module contains the visualizations offered in pm4py.
Note on Graphviz-based visualizations (e.g., Petri nets, DFGs, BPMN, process trees):
Supported output formats include:
png: Generates a PNG image.
svg: Generates an SVG image, which can be scaled without loss of quality.
pdf: Generates a PDF file, suitable for printing and embedding in documents.
gv: Returns or saves the Dot source code of the Graphviz graph.
html: When ‘html’ is provided as the format, the visualization is rendered in an HTML page using GraphvizJS. This allows interactive viewing of the graph directly in a web browser.
If html is used, an HTML file containing the GraphvizJS-based rendering is produced, enabling panning, zooming, and other interactive features.
In general, for Graphviz-based visualizations, if you provide a format extension, the visualization will be generated accordingly. For example: - format=’png’ will produce a PNG file. - format=’svg’ will produce an SVG file. - format=’pdf’ will produce a PDF file. - format=’gv’ will return/save the raw Dot code. - format=’html’ will produce an interactive HTML visualization using GraphvizJS.
- pm4py.vis.view_petri_net(petri_net: PetriNet, initial_marking: Marking | None = None, final_marking: Marking | None = None, format: str = 'png', bgcolor: str = 'white', decorations: Dict[Any, Any] = None, debug: bool = False, rankdir: str = 'LR', graph_title: str | None = None, variant_str: str = 'wo_decoration', log: EventLog | DataFrame | None = None)[source]#
Views a (composite) Petri net.
- Parameters:
petri_net – Petri net
initial_marking – Initial marking
final_marking – Final marking
format – Format of the output picture (if ‘html’ is provided, GraphvizJS is used to render the visualization in an HTML page)
bgcolor – Background color of the visualization (default: white)
decorations – Decorations (color, label) associated with the elements of the Petri net
debug – Boolean enabling/disabling debug mode (shows place and transition names)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
graph_title – Sets the title of the visualization (if provided)
variant_str – The variant to be used (possible values: ‘wo_decoration’, ‘token_decoration_frequency’, ‘token_decoration_performance’, ‘greedy_decoration_frequency’, ‘greedy_decoration_performance’, ‘alignments’)
log – The event log or Pandas dataframe that should be used, if decoration is required
import pm4py net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.view_petri_net(net, im, fm, format='svg')
- pm4py.vis.save_vis_petri_net(petri_net: PetriNet, initial_marking: Marking, final_marking: Marking, file_path: str, bgcolor: str = 'white', decorations: Dict[Any, Any] = None, debug: bool = False, rankdir: str = 'LR', graph_title: str | None = None, variant_str: str = 'wo_decoration', log: EventLog | DataFrame | None = None, **kwargs)[source]#
Saves a Petri net visualization to a file.
- Parameters:
petri_net – Petri net
initial_marking – Initial marking
final_marking – Final marking
file_path – Destination path
bgcolor – Background color of the visualization (default: white)
decorations – Decorations (color, label) associated with the elements of the Petri net
debug – Boolean enabling/disabling debug mode (shows place and transition names)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
graph_title – Sets the title of the visualization (if provided)
variant_str – The variant to be used (possible values: ‘wo_decoration’, ‘token_decoration_frequency’, ‘token_decoration_performance’, ‘greedy_decoration_frequency’, ‘greedy_decoration_performance’, ‘alignments’)
log – The event log or Pandas dataframe that should be used, if decoration is required
import pm4py net, im, fm = pm4py.discover_petri_net_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.save_vis_petri_net(net, im, fm, 'petri_net.png')
- pm4py.vis.view_performance_dfg(dfg: dict, start_activities: dict, end_activities: dict, format: str = 'png', aggregation_measure='mean', bgcolor: str = 'white', rankdir: str = 'LR', serv_time: Dict[str, float] | None = None, graph_title: str | None = None)[source]#
Views a performance DFG.
- Parameters:
dfg – DFG object
start_activities – Start activities
end_activities – End activities
format – Format of the output picture (if ‘html’ is provided, GraphvizJS is used to render the visualization in an HTML page)
aggregation_measure – Aggregation measure (default: mean), possible values: mean, median, min, max, sum, stdev
bgcolor – Background color of the visualization (default: white)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
serv_time – (optional) Provides the activities’ service times, used to decorate the graph
graph_title – Sets the title of the visualization (if provided)
import pm4py performance_dfg, start_activities, end_activities = pm4py.discover_performance_dfg(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp') pm4py.view_performance_dfg(performance_dfg, start_activities, end_activities, format='svg')
- pm4py.vis.save_vis_performance_dfg(dfg: dict, start_activities: dict, end_activities: dict, file_path: str, aggregation_measure='mean', bgcolor: str = 'white', rankdir: str = 'LR', serv_time: Dict[str, float] | None = None, graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of a performance DFG.
- Parameters:
dfg – DFG object
start_activities – Start activities
end_activities – End activities
file_path – Destination path
aggregation_measure – Aggregation measure (default: mean), possible values: mean, median, min, max, sum, stdev
bgcolor – Background color of the visualization (default: white)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
serv_time – (optional) Provides the activities’ service times, used to decorate the graph
graph_title – Sets the title of the visualization (if provided)
import pm4py performance_dfg, start_activities, end_activities = pm4py.discover_performance_dfg(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp') pm4py.save_vis_performance_dfg(performance_dfg, start_activities, end_activities, 'perf_dfg.png')
- pm4py.vis.view_dfg(dfg: dict, start_activities: dict, end_activities: dict, format: str = 'png', bgcolor: str = 'white', max_num_edges: int = 9223372036854775807, rankdir: str = 'LR', graph_title: str | None = None)[source]#
Views a (composite) DFG.
- Parameters:
dfg – DFG object
start_activities – Start activities
end_activities – End activities
format – Format of the output picture (if ‘html’ is provided, GraphvizJS is used to render the visualization in an HTML page)
bgcolor – Background color of the visualization (default: white)
max_num_edges – Maximum number of edges to represent in the graph
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
graph_title – Sets the title of the visualization (if provided)
import pm4py dfg, start_activities, end_activities = pm4py.discover_dfg(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp') pm4py.view_dfg(dfg, start_activities, end_activities, format='svg')
- pm4py.vis.save_vis_dfg(dfg: dict, start_activities: dict, end_activities: dict, file_path: str, bgcolor: str = 'white', max_num_edges: int = 9223372036854775807, rankdir: str = 'LR', graph_title: str | None = None, **kwargs)[source]#
Saves a DFG visualization to a file.
- Parameters:
dfg – DFG object
start_activities – Start activities
end_activities – End activities
file_path – Destination path
bgcolor – Background color of the visualization (default: white)
max_num_edges – Maximum number of edges to represent in the graph
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
graph_title – Sets the title of the visualization (if provided)
import pm4py dfg, start_activities, end_activities = pm4py.discover_dfg(dataframe, case_id_key='case:concept:name', activity_key='concept:name', timestamp_key='time:timestamp') pm4py.save_vis_dfg(dfg, start_activities, end_activities, 'dfg.png')
- pm4py.vis.view_process_tree(tree: ProcessTree, format: str = 'png', bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None)[source]#
Views a process tree.
- Parameters:
tree – Process tree
format – Format of the visualization (if ‘html’ is provided, GraphvizJS is used to render the visualization in an HTML page)
bgcolor – Background color of the visualization (default: white)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
graph_title – Sets the title of the visualization (if provided)
import pm4py process_tree = pm4py.discover_process_tree_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.view_process_tree(process_tree, format='svg')
- pm4py.vis.save_vis_process_tree(tree: ProcessTree, file_path: str, bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of a process tree.
- Parameters:
tree – Process tree
file_path – Destination path
bgcolor – Background color of the visualization (default: white)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
graph_title – Sets the title of the visualization (if provided)
import pm4py process_tree = pm4py.discover_process_tree_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.save_vis_process_tree(process_tree, 'process_tree.png')
- pm4py.vis.save_vis_bpmn(bpmn_graph: BPMN, file_path: str, bgcolor: str = 'white', rankdir: str = 'LR', variant_str: str = 'classic', graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of a BPMN graph.
- Parameters:
bpmn_graph – BPMN graph
file_path – Destination path
bgcolor – Background color of the visualization (default: white)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
variant_str – Variant of the visualization to be used (“classic” or “dagrejs”)
graph_title – Sets the title of the visualization (if provided)
import pm4py bpmn_graph = pm4py.discover_bpmn_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.save_vis_bpmn(bpmn_graph, 'trial.bpmn')
- pm4py.vis.view_bpmn(bpmn_graph: BPMN, format: str = 'png', bgcolor: str = 'white', rankdir: str = 'LR', variant_str: str = 'classic', graph_title: str | None = None)[source]#
Views a BPMN graph.
- Parameters:
bpmn_graph – BPMN graph
format – Format of the visualization (if ‘html’ is provided, GraphvizJS is used to render the visualization in an HTML page)
bgcolor – Background color of the visualization (default: white)
rankdir – Sets the direction of the graph (“LR” for left-to-right; “TB” for top-to-bottom)
variant_str – Variant of the visualization to be used (“classic” or “dagrejs”)
graph_title – Sets the title of the visualization (if provided)
import pm4py bpmn_graph = pm4py.discover_bpmn_inductive(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.view_bpmn(bpmn_graph)
- pm4py.vis.view_heuristics_net(heu_net: HeuristicsNet, format: str = 'png', bgcolor: str = 'white', graph_title: str | None = None)[source]#
Views a heuristics net.
- Parameters:
heu_net – Heuristics net
format – Format of the visualization
bgcolor – Background color of the visualization (default: white)
graph_title – Sets the title of the visualization (if provided)
import pm4py heu_net = pm4py.discover_heuristics_net(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.view_heuristics_net(heu_net, format='svg')
- pm4py.vis.save_vis_heuristics_net(heu_net: HeuristicsNet, file_path: str, bgcolor: str = 'white', graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of a heuristics net.
- Parameters:
heu_net – Heuristics net
file_path – Destination path
bgcolor – Background color of the visualization (default: white)
graph_title – Sets the title of the visualization (if provided)
import pm4py heu_net = pm4py.discover_heuristics_net(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.save_vis_heuristics_net(heu_net, 'heu.png')
- pm4py.vis.view_dotted_chart(log: EventLog | DataFrame, format: str = 'png', attributes=None, bgcolor: str = 'white', show_legend: bool = True, graph_title: str | None = None)[source]#
Displays the dotted chart.
Each event in the log is represented as a point. Dimensions are: - X-axis: The value of the first selected attribute. - Y-axis: The value of the second selected attribute. - Color: The value of the third selected attribute.
If attributes are not provided, a default dotted chart is shown: X-axis: time Y-axis: case index (in order of occurrence) Color: activity
- Parameters:
log – Event log
format – Image format
attributes – Attributes used to construct the dotted chart. If None, the default dotted chart is used. For custom attributes, use a list of the form [x-axis attribute, y-axis attribute, color attribute].
bgcolor – Background color of the chart (default: white)
show_legend – Boolean (enables/disables the legend)
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.view_dotted_chart(dataframe, format='svg') pm4py.view_dotted_chart(dataframe, attributes=['time:timestamp', 'concept:name', 'org:resource'])
- pm4py.vis.save_vis_dotted_chart(log: EventLog | DataFrame, file_path: str, attributes=None, bgcolor: str = 'white', show_legend: bool = True, graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of the dotted chart.
Each event in the log is represented as a point. Dimensions are: - X-axis: The value of the first selected attribute. - Y-axis: The value of the second selected attribute. - Color: The value of the third selected attribute.
If attributes are not provided, a default dotted chart is used: X-axis: time Y-axis: case index (in order of occurrence) Color: activity
- Parameters:
log – Event log
file_path – Destination path
attributes – Attributes for the dotted chart. For example, [“time:timestamp”, “concept:name”, “org:resource”].
bgcolor – Background color of the chart (default: white)
show_legend – Boolean (enables/disables the legend)
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.save_vis_dotted_chart(dataframe, 'dotted.png', attributes=['time:timestamp', 'concept:name', 'org:resource'])
- pm4py.vis.view_sna(sna_metric: SNA, variant_str: str | None = None)[source]#
Represents a SNA metric (.html).
- Parameters:
sna_metric – Values of the metric
variant_str – Variant to be used (default: pyvis)
import pm4py metric = pm4py.discover_subcontracting_network(dataframe, resource_key='org:resource', timestamp_key='time:timestamp', case_id_key='case:concept:name') pm4py.view_sna(metric)
- pm4py.vis.save_vis_sna(sna_metric: SNA, file_path: str, variant_str: str | None = None, **kwargs)[source]#
Saves the visualization of a SNA metric in a .html file.
- Parameters:
sna_metric – Values of the metric
file_path – Destination path
variant_str – Variant to be used (default: pyvis)
import pm4py metric = pm4py.discover_subcontracting_network(dataframe, resource_key='org:resource', timestamp_key='time:timestamp', case_id_key='case:concept:name') pm4py.save_vis_sna(metric, 'sna.png')
- pm4py.vis.view_case_duration_graph(log: EventLog | DataFrame, format: str = 'png', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', graph_title: str | None = None)[source]#
Visualizes the case duration graph.
- Parameters:
log – Log object
format – Format of the visualization (png, svg, …)
activity_key – Attribute to be used as activity
case_id_key – Attribute to be used as case identifier
timestamp_key – Attribute to be used as timestamp
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.view_case_duration_graph(dataframe, format='svg', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.save_vis_case_duration_graph(log: EventLog | DataFrame, file_path: str, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', graph_title: str | None = None, **kwargs)[source]#
Saves the case duration graph to the specified path.
- Parameters:
log – Log object
file_path – Destination path
activity_key – Attribute to be used as activity
case_id_key – Attribute to be used as case identifier
timestamp_key – Attribute to be used as timestamp
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.save_vis_case_duration_graph(dataframe, 'duration.png', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.view_events_per_time_graph(log: EventLog | DataFrame, format: str = 'png', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', graph_title: str | None = None)[source]#
Visualizes the events per time graph.
- Parameters:
log – Log object
format – Format of the visualization (png, svg, …)
activity_key – Attribute to be used as activity
case_id_key – Attribute to be used as case identifier
timestamp_key – Attribute to be used as timestamp
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.view_events_per_time_graph(dataframe, format='svg', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.save_vis_events_per_time_graph(log: EventLog | DataFrame, file_path: str, activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', graph_title: str | None = None, **kwargs)[source]#
Saves the events per time graph to the specified path.
- Parameters:
log – Log object
file_path – Destination path
activity_key – Attribute to be used as activity
case_id_key – Attribute to be used as case identifier
timestamp_key – Attribute to be used as timestamp
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.save_vis_events_per_time_graph(dataframe, 'ev_time.png', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.view_performance_spectrum(log: EventLog | DataFrame, activities: List[str], format: str = 'png', activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name', bgcolor: str = 'white', graph_title: str | None = None)[source]#
Displays the performance spectrum.
The performance spectrum is a novel visualization of the performance of the process, showing time elapsed between different activities. Refer to: Denisov, Vadim, et al. “The Performance Spectrum Miner: Visual Analytics for Fine-Grained Performance Analysis of Processes.” BPM (Dissertation/Demos/Industry). 2018.
- Parameters:
log – Event log
activities – List of activities (in order) used to build the performance spectrum
format – Format of the visualization (png, svg …)
activity_key – Attribute to be used for the activity
timestamp_key – Attribute to be used for the timestamp
case_id_key – Attribute to be used as case identifier
bgcolor – Background color of the visualization (default: white)
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.view_performance_spectrum(dataframe, ['Act. A', 'Act. C', 'Act. D'], format='svg', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.save_vis_performance_spectrum(log: EventLog | DataFrame, activities: List[str], file_path: str, activity_key: str = 'concept:name', timestamp_key: str = 'time:timestamp', case_id_key: str = 'case:concept:name', bgcolor: str = 'white', graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of the performance spectrum to a file.
Refer to: Denisov, Vadim, et al. “The Performance Spectrum Miner: Visual Analytics for Fine-Grained Performance Analysis of Processes.” BPM (Dissertation/Demos/Industry). 2018.
- Parameters:
log – Event log
activities – List of activities used to build the performance spectrum
file_path – Destination path (including the extension)
activity_key – Attribute to be used for the activity
timestamp_key – Attribute to be used for the timestamp
case_id_key – Attribute to be used as case identifier
bgcolor – Background color of the visualization (default: white)
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.save_vis_performance_spectrum(dataframe, ['Act. A', 'Act. C', 'Act. D'], 'perf_spec.png', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.view_events_distribution_graph(log: EventLog | DataFrame, distr_type: str = 'days_week', format='png', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', graph_title: str | None = None)[source]#
Shows the distribution of the events in the specified dimension.
This allows identifying work shifts, busy days, and busy periods of the year.
- Parameters:
log – Event log
distr_type – Type of distribution (default: days_week): - days_month: Distribution of events among days of a month (1-31) - months: Distribution of events among months (1-12) - years: Distribution of events among years - hours: Distribution of events among hours of a day (0-23) - days_week: Distribution of events among days of the week (Mon-Sun) - weeks: Distribution of events among weeks of a year (0-52)
format – Format of the visualization (default: png)
activity_key – Attribute to be used as activity
case_id_key – Attribute to be used as case identifier
timestamp_key – Attribute to be used as timestamp
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.view_events_distribution_graph(dataframe, format='svg', distr_type='days_week', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.save_vis_events_distribution_graph(log: EventLog | DataFrame, file_path: str, distr_type: str = 'days_week', activity_key='concept:name', timestamp_key='time:timestamp', case_id_key='case:concept:name', graph_title: str | None = None, **kwargs)[source]#
Saves the distribution of the events in a picture file.
Observing the distribution of events over time helps infer work shifts, working days, and busy periods of the year.
- Parameters:
log – Event log
file_path – Destination path (including the extension)
distr_type – Type of distribution (default: days_week): - days_month: Events distribution among days of a month (1-31) - months: Events distribution among months (1-12) - years: Events distribution among years - hours: Events distribution among hours of a day (0-23) - days_week: Events distribution among days of a week (Mon-Sun) - weeks: Events distribution among weeks of a year (0-52)
activity_key – Attribute to be used as activity
case_id_key – Attribute to be used as case identifier
timestamp_key – Attribute to be used as timestamp
graph_title – Sets the title of the visualization (if provided)
import pm4py pm4py.save_vis_events_distribution_graph(dataframe, 'ev_distr_graph.png', distr_type='days_week', activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp')
- pm4py.vis.view_ocdfg(ocdfg: Dict[str, Any], annotation: str = 'frequency', act_metric: str = 'events', edge_metric='event_couples', act_threshold: int = 0, edge_threshold: int = 0, performance_aggregation: str = 'mean', format: str = 'png', bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None, variant_str: str = 'classic')[source]#
Views an OC-DFG (object-centric directly-follows graph).
- Parameters:
ocdfg – Object-centric directly-follows graph
annotation – The annotation to use (“frequency” or “performance”)
act_metric – The metric for activities (“events”, “unique_objects”, “total_objects”)
edge_metric – The metric for edges (“event_couples”, “unique_objects”, “total_objects”)
act_threshold – Threshold on activities frequency (default: 0)
edge_threshold – Threshold on edges frequency (default: 0)
performance_aggregation – Aggregation measure for performance: mean, median, min, max, sum
format – Format of the output (if ‘html’ is provided, GraphvizJS is used)
bgcolor – Background color (default: white)
rankdir – Graph direction (“LR” or “TB”)
graph_title – Title of the visualization (if provided)
variant_str – Variant of the visualization (“classic” or “elkjs”)
import pm4py ocdfg = pm4py.discover_ocdfg(ocel) pm4py.view_ocdfg(ocdfg, annotation='frequency', format='svg')
- pm4py.vis.save_vis_ocdfg(ocdfg: Dict[str, Any], file_path: str, annotation: str = 'frequency', act_metric: str = 'events', edge_metric='event_couples', act_threshold: int = 0, edge_threshold: int = 0, performance_aggregation: str = 'mean', bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None, variant_str: str = 'classic', **kwargs)[source]#
Saves the visualization of an OC-DFG.
- Parameters:
ocdfg – Object-centric directly-follows graph
file_path – Destination path
annotation – “frequency” or “performance”
act_metric – Metric for activities (“events”, “unique_objects”, “total_objects”)
edge_metric – Metric for edges (“event_couples”, “unique_objects”, “total_objects”)
act_threshold – Threshold on activities frequency
edge_threshold – Threshold on edges frequency
performance_aggregation – Aggregation measure for performance: mean, median, min, max, sum
bgcolor – Background color (default: white)
rankdir – Graph direction (“LR” or “TB”)
graph_title – Title of the visualization (if provided)
variant_str – Variant (“classic” or “elkjs”)
import pm4py ocdfg = pm4py.discover_ocdfg(ocel) pm4py.save_vis_ocdfg(ocdfg, 'ocdfg.png', annotation='frequency')
- pm4py.vis.view_ocpn(ocpn: Dict[str, Any], format: str = 'png', bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None, variant_str: str = 'wo_decoration')[source]#
Visualizes the object-centric Petri net.
- Parameters:
ocpn – Object-centric Petri net
format – Format of the visualization (if ‘html’ is provided, GraphvizJS is used)
bgcolor – Background color (default: white)
rankdir – Graph direction (“LR” or “TB”)
graph_title – Title of the visualization (if provided)
variant_str – Variant to be used (“wo_decoration” or “brachmann”)
import pm4py ocpn = pm4py.discover_oc_petri_net(ocel) pm4py.view_ocpn(ocpn, format='svg')
- pm4py.vis.save_vis_ocpn(ocpn: Dict[str, Any], file_path: str, bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None, variant_str: str = 'wo_decoration', **kwargs)[source]#
Saves the visualization of the object-centric Petri net into a file.
- Parameters:
ocpn – Object-centric Petri net
file_path – Target path
bgcolor – Background color (default: white)
rankdir – Graph direction (“LR” or “TB”)
graph_title – Title of the visualization (if provided)
variant_str – Variant to be used (“wo_decoration” or “brachmann”)
import pm4py ocpn = pm4py.discover_oc_petri_net(ocel) pm4py.save_vis_ocpn(ocpn, 'ocpn.png')
- pm4py.vis.view_network_analysis(network_analysis: Dict[Tuple[str, str], Dict[str, Any]], variant: str = 'frequency', format: str = 'png', activity_threshold: int = 1, edge_threshold: int = 1, bgcolor: str = 'white', graph_title: str | None = None)[source]#
Visualizes the network analysis.
- Parameters:
network_analysis – Network analysis
variant – “frequency” or “performance”
format – Format of the visualization (if ‘html’ is provided, GraphvizJS is used)
activity_threshold – Minimum occurrences of an activity to be included
edge_threshold – Minimum occurrences of an edge to be included
bgcolor – Background color (default: white)
graph_title – Title of the visualization (if provided)
import pm4py net_ana = pm4py.discover_network_analysis(dataframe, out_column='case:concept:name', in_column='case:concept:name', node_column_source='org:resource', node_column_target='org:resource', edge_column='concept:name') pm4py.view_network_analysis(net_ana, format='svg')
- pm4py.vis.save_vis_network_analysis(network_analysis: Dict[Tuple[str, str], Dict[str, Any]], file_path: str, variant: str = 'frequency', activity_threshold: int = 1, edge_threshold: int = 1, bgcolor: str = 'white', graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of the network analysis.
- Parameters:
network_analysis – Network analysis
file_path – Target path
variant – “frequency” or “performance”
activity_threshold – Minimum occurrences of an activity
edge_threshold – Minimum occurrences of an edge
bgcolor – Background color (default: white)
graph_title – Title of the visualization (if provided)
import pm4py net_ana = pm4py.discover_network_analysis(dataframe, out_column='case:concept:name', in_column='case:concept:name', node_column_source='org:resource', node_column_target='org:resource', edge_column='concept:name') pm4py.save_vis_network_analysis(net_ana, 'net_ana.png')
- pm4py.vis.view_transition_system(transition_system: TransitionSystem, format: str = 'png', bgcolor: str = 'white', graph_title: str | None = None)[source]#
Views a transition system.
- Parameters:
transition_system – Transition system
format – Format of the visualization (if ‘html’ is provided, GraphvizJS is used)
bgcolor – Background color (default: white)
graph_title – Title of the visualization (if provided)
import pm4py transition_system = pm4py.discover_transition_system(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.view_transition_system(transition_system, format='svg')
- pm4py.vis.save_vis_transition_system(transition_system: TransitionSystem, file_path: str, bgcolor: str = 'white', graph_title: str | None = None, **kwargs)[source]#
Persists the visualization of a transition system.
- Parameters:
transition_system – Transition system
file_path – Destination path
bgcolor – Background color (default: white)
graph_title – Title of the visualization (if provided)
import pm4py transition_system = pm4py.discover_transition_system(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.save_vis_transition_system(transition_system, 'trans_system.png')
- pm4py.vis.view_prefix_tree(trie: Trie, format: str = 'png', bgcolor: str = 'white', graph_title: str | None = None)[source]#
Views a prefix tree.
- Parameters:
trie – Prefix tree
format – Format of the visualization (if ‘html’ is provided, GraphvizJS is used)
bgcolor – Background color (default: white)
graph_title – Title of the visualization (if provided)
import pm4py prefix_tree = pm4py.discover_prefix_tree(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.view_prefix_tree(prefix_tree, format='svg')
- pm4py.vis.save_vis_prefix_tree(trie: Trie, file_path: str, bgcolor: str = 'white', graph_title: str | None = None, **kwargs)[source]#
Persists the visualization of a prefix tree.
- Parameters:
trie – Prefix tree
file_path – Destination path
bgcolor – Background color (default: white)
graph_title – Title of the visualization (if provided)
import pm4py prefix_tree = pm4py.discover_prefix_tree(dataframe, activity_key='concept:name', case_id_key='case:concept:name', timestamp_key='time:timestamp') pm4py.save_vis_prefix_tree(prefix_tree, 'trie.png')
- pm4py.vis.view_alignments(log: EventLog | DataFrame, aligned_traces: List[Dict[str, Any]], format: str = 'png', graph_title: str | None = None)[source]#
Views the alignment table as a figure.
- Parameters:
log – Event log
aligned_traces – Results of an alignment
format – Format of the visualization (default: png)
graph_title – Title of the visualization (if provided)
import pm4py log = pm4py.read_xes('tests/input_data/running-example.xes') net, im, fm = pm4py.discover_petri_net_inductive(log) aligned_traces = pm4py.conformance_diagnostics_alignments(log, net, im, fm) pm4py.view_alignments(log, aligned_traces, format='svg')
- pm4py.vis.save_vis_alignments(log: EventLog | DataFrame, aligned_traces: List[Dict[str, Any]], file_path: str, graph_title: str | None = None, **kwargs)[source]#
Saves an alignment table’s figure on disk.
- Parameters:
log – Event log
aligned_traces – Results of an alignment
file_path – Target path
graph_title – Title of the visualization (if provided)
import pm4py log = pm4py.read_xes('tests/input_data/running-example.xes') net, im, fm = pm4py.discover_petri_net_inductive(log) aligned_traces = pm4py.conformance_diagnostics_alignments(log, net, im, fm) pm4py.save_vis_alignments(log, aligned_traces, 'output.svg')
- pm4py.vis.view_footprints(footprints: Tuple[Dict[str, Any], Dict[str, Any]] | Dict[str, Any], format: str = 'png', graph_title: str | None = None)[source]#
Views the footprints as a figure.
- Parameters:
footprints – Footprints
format – Format of the visualization (default: png)
graph_title – Title of the visualization (if provided)
import pm4py log = pm4py.read_xes('tests/input_data/running-example.xes') fp_log = pm4py.discover_footprints(log) pm4py.view_footprints(fp_log, format='svg')
- pm4py.vis.save_vis_footprints(footprints: Tuple[Dict[str, Any], Dict[str, Any]] | Dict[str, Any], file_path: str, graph_title: str | None = None, **kwargs)[source]#
Saves the footprints’ visualization on disk.
- Parameters:
footprints – Footprints
file_path – Target path
graph_title –
Title of the visualization (if provided)
import pm4py log = pm4py.read_xes('tests/input_data/running-example.xes') fp_log = pm4py.discover_footprints(log) pm4py.save_vis_footprints(fp_log, 'output.svg')
- pm4py.vis.view_powl(powl: POWL, format: str = 'png', bgcolor: str = 'white', variant_str: str = 'basic', graph_title: str | None = None)[source]#
Performs a visualization of a POWL model.
Reference: Kourani, Humam, and Sebastiaan J. van Zelst. “POWL: partially ordered workflow language.” International Conference on Business Process Management. Cham: Springer Nature Switzerland, 2023.
- Parameters:
powl – POWL model
format – Format of the visualization (default: png)
bgcolor – Background color (default: white)
variant_str – Variant of the visualization to be used (“basic” or “net”)
graph_title –
Title of the visualization (if provided)
import pm4py log = pm4py.read_xes('tests/input_data/running-example.xes') powl_model = pm4py.discover_powl(log) pm4py.view_powl(powl_model, format='svg', variant_str='basic') pm4py.view_powl(powl_model, format='svg', variant_str='net')
- pm4py.vis.save_vis_powl(powl: POWL, file_path: str, bgcolor: str = 'white', rankdir: str = 'TB', graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of a POWL model.
Reference: Kourani, Humam, and Sebastiaan J. van Zelst. “POWL: partially ordered workflow language.” International Conference on Business Process Management. Cham: Springer Nature Switzerland, 2023.
- Parameters:
powl – POWL model
file_path – Target path
bgcolor – Background color (default: white)
rankdir – Graph direction (“LR” or “TB”)
graph_title –
Title of the visualization (if provided)
import pm4py log = pm4py.read_xes('tests/input_data/running-example.xes') powl_model = pm4py.discover_powl(log) pm4py.save_vis_powl(powl_model, 'powl.png')
- pm4py.vis.view_object_graph(ocel: OCEL, graph: Set[Tuple[str, str]], format: str = 'png', bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None)[source]#
Visualizes an object graph on the screen.
- Parameters:
ocel – Object-centric event log
graph – Object graph
format – Format of the visualization (if ‘html’ is provided, GraphvizJS is used)
bgcolor – Background color (default: white)
rankdir – Graph direction (“LR” or “TB”)
graph_title – Title of the visualization (if provided)
import pm4py ocel = pm4py.read_ocel('trial.ocel') obj_graph = pm4py.ocel_discover_objects_graph(ocel, graph_type='object_interaction') pm4py.view_object_graph(ocel, obj_graph, format='svg')
- pm4py.vis.save_vis_object_graph(ocel: OCEL, graph: Set[Tuple[str, str]], file_path: str, bgcolor: str = 'white', rankdir: str = 'LR', graph_title: str | None = None, **kwargs)[source]#
Saves the visualization of an object graph.
- Parameters:
ocel – Object-centric event log
graph – Object graph
file_path – Destination path
bgcolor – Background color (default: white)
rankdir – Graph direction (“LR” or “TB”)
graph_title – Title of the visualization (if provided)
import pm4py ocel = pm4py.read_ocel('trial.ocel') obj_graph = pm4py.ocel_discover_objects_graph(ocel, graph_type='object_interaction') pm4py.save_vis_object_graph(ocel, obj_graph, 'trial.pdf')