pm4py.vis.save_vis_petri_net#
- 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 (
PetriNet) – Petri netinitial_marking (
Marking) – Initial markingfinal_marking (
Marking) – Final markingfile_path (
str) – Destination pathbgcolor (
str) – Background color of the visualization (default: white)decorations – Decorations (color, label) associated with the elements of the Petri net
debug (
bool) – Boolean enabling/disabling debug mode (shows place and transition names)rankdir (
str) – 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 (
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')