pm4py / pm4py-core

Public repository for the PM4Py (Process Mining for Python) project.
https://pm4py.fit.fraunhofer.de
GNU General Public License v3.0
722 stars 286 forks source link

How to set a 'dpi' for Discovery algorithm? #345

Closed lukeaust closed 2 years ago

lukeaust commented 2 years ago

Hi, I want to save a clear Petri net but how to set the 'dpi' like matplotlib


import os

import pm4py
from pm4py.objects.log.importer.xes import importer as xes_import
from pm4py.algo.discovery.alpha import algorithm as alpha_miner
from pm4py.visualization.petri_net import visualizer as pn_vis
from pm4py.algo.discovery.inductive import algorithm as ind_miner
from pm4py.visualization.process_tree import visualizer as pt_vis
from pm4py.objects.conversion.process_tree import converter
from pm4py.algo.evaluation.replay_fitness import algorithm
from pm4py.statistics.variants.log import get as variants_module
from pm4py.algo.discovery.inductive.variants.im_clean.algorithm import Parameters
def execute_script():
    # log_path = 'receipt.xes'
    log_path = '../input_data/interval_event_log.xes'
    log = xes_import.apply(log_path)
    #log = keep_one_trace_per_variant(log)
    #log = log[15:30]
    ptree = ind_miner.apply_tree(log, parameters={Parameters.NOISE_THRESHOLD: 0.5}, variant=ind_miner.Variants.IM_CLEAN)
    gviz = pt_vis.apply(ptree,
                        parameters={pt_vis.Variants.WO_DECORATION.value.Parameters.FORMAT: "png"})

    net, im, fm = converter.apply(ptree)

    gviz = pn_vis.apply(net, im, fm,
                        parameters={pn_vis.Variants.WO_DECORATION.value.Parameters.FORMAT: "png",
                                    pn_vis.Variants.WO_DECORATION.value.Parameters.DEBUG: False})
    pn_vis.view(gviz)
    pm4py.save_vis_petri_net(net, im, fm, "../results/figs/pn_interval_event_log_im.png")
if __name__ == "__main__":
    execute_script()
fit-alessandro-berti commented 2 years ago

Dear lukeaust,

For this purpose, please use the svg format which is vectorial and renders perfectly at any size.

lukeaust commented 2 years ago

OK, got it. Thanks a lot.