kglab icon indicating copy to clipboard operation
kglab copied to clipboard

Auto adjust window size when visualizing the graph

Open jli113 opened this issue 3 years ago • 3 comments

I'm submitting a

  • [x] feature request.

Current Behaviour:

subgraph tensor is too small when showing the graph

Expected Behaviour:

subgraph tensor will adjust window size when showing the graph

Steps to reproduce:

import kglab kg = kglab.KnowledgeGraph().load_rdf("tmp.ttl") VIS_STYLE = { "wtm": { "color": "orange", "size": 40, }, "ind":{ "color": "blue", "size": 30, }, } subgraph = kglab.SubgraphTensor(kg) pyvis_graph = subgraph.build_pyvis_graph(notebook=True, style=VIS_STYLE)

Snapshot:

Environment:

  • python version 3.9.11
  • pip version
  • OS details ubuntu 20.04.4 64

jli113 avatar Jul 02 '22 04:07 jli113

change the line "pyvis_graph = pyvis.network.Network(notebook=notebook)" in subg.py after line 465 to, import pyautogui wid, hei= pyautogui.size() pyvis_graph = pyvis.network.Network(width='{}px'.format(wid), height='{}px'.format(hei), notebook=notebook)

jli113 avatar Jul 02 '22 04:07 jli113

Hi @jli113 this look interesting.

For our library use overall, we're supporting more integrations for visualization than pyvis so the approach would need to be generalized.

The code shown above would work for the tutorial notebook for pyvis Do you have a PR that you can submit?

Thanks - paco

ceteri avatar Jul 03 '22 09:07 ceteri

It worked fine inside the notebook, but maybe too small when not using the notebook.

jli113 avatar Jul 05 '22 06:07 jli113