You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
True. it seems that Colab does not like running javascript.
I need to look into this. I tried the underneath but did not work. It may give you some hints in the direction where you can look at.
from IPython.display import IFrame
IFrame(src='/tmp/tmppuhff_dn/d3graph.html', width=900, height=600)
The IFrame model does indeed work in JupyterLab (I am not sure about collab) however due to security restrictions, the html file must be in the same directory as the notebook. So, even a fully qualified path to the file will give a 404 error, but just the filename, as long as it's in the same directory works.
I've gotten around this by using os.getcwd to get the working directory of the notebook and then saving the file explicitly where the notebook is. Works great.
This basic code is from the example:
`!pip install d3graph
from d3graph import d3graph, vec2adjmat
Create example network
source = ['node A','node F','node B','node B','node B','node A','node C','node Z']
target = ['node F','node B','node J','node F','node F','node M','node M','node A']
weight = [5.56, 0.5, 0.64, 0.23, 0.9, 3.28, 0.5, 0.45]
Convert to adjacency matrix
adjmat = vec2adjmat(source, target, weight=weight)
Initialize
d3 = d3graph()
Proces adjmat
d3.graph(adjmat)
Plot
d3.show()`
But this does not appear to work.
It does seem to be generating the html, but not showing it in google collab.
Would it be possible to have some example code that shows how to get the project to work on that platform?
-ft
The text was updated successfully, but these errors were encountered: