Skip to content

Network.set_options doesn't work when loading the graph from a DOT file. #129

@tuschla

Description

@tuschla

I tried using the set_options method as boludo00 demonstrated. This works fine.

However when I read the edges and nodes from a DOT file the options I set afterwards with set_options have no effect.

What you can do to replicate this:

import pyvis
graph = pyvis.network.Network()
graph.from_DOT("./example_dotfile.dot")
graph.set_options("""
var options = {
    "physics": {
        "enabled": false,
        "stabilization": 10,
        "barnesHut": {
            "springLength": 200
        }
    }
}
""")
graph.show("test.html")

Here is an example DOT file for testing:

digraph {
    a [label=12];
    b [label=7];
    c [label=3];
    a -> b[label="solid edge"];                     
    a -> b [label="dashed edge"]; 
    a -> c [label="dashed edge"]; 
    a -> c [label="dotted edge"];      
}

Adding the following to the generated js will work though.

options.physics = {
    enabled: false,
    stabilization: 10,
    barnesHut: {
        springLength: 200
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions