causalnex icon indicating copy to clipboard operation
causalnex copied to clipboard

plot edges misplace when use plot_structure function

Open miaokyle opened this issue 2 years ago • 2 comments

Description

I tried the code below:

from causalnex.structure import StructureModel test2sm = StructureModel() test2sm.add_edges_from([('a','b'),('a','c')]) viz = plot_structure( test2sm, graph_attributes={"scale": "0.5"}, all_node_attributes=NODE_STYLE.WEAK, all_edge_attributes=EDGE_STYLE.WEAK, ) Image(viz.draw(format='png'))

On the plot, the edges misplaced and the label overlapped with the nodes.

Screenshot 2021-11-18 113920

OS: win10 CPU: Intel Core i7 GPU: none python: 3.8.10 anaconda: 4.10.3 causalnex: 0.11.0 pygraphviz:1.7

How can I resolve this problem? Thank you

miaokyle avatar Nov 18 '21 16:11 miaokyle

Save problem, do you fix that ?

palvors avatar Jun 16 '22 14:06 palvors

Ohh, I resovle for me. I just looking for requirement about some project on kaggle that work

conda install pygraphviz=1.6

and that work.

image

palvors avatar Jun 16 '22 19:06 palvors

Hi @miaokyle, @palvors, and thanks for the question!

I was unable to reproduce issue on Win 10 machine with the following setup:

python               3.8.13
pygraphviz           1.5.            # this version was installed by default
causalnex            0.11.0

You can try following steps to solve the issue:

  • Install Grapviz with Chocolatey package manager, detailed steps can be found in pygraphviz installation guide: https://pygraphviz.github.io/documentation/stable/install.html
  • Install pygraphviz with conda install --channel conda-forge pygraphviz

I hope it helps!

EvgeniiaVeselova avatar Aug 25 '22 11:08 EvgeniiaVeselova