Skip to content

Commit

Permalink
Changes to solve #2443-pyvis-three-minor-enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
duxans committed Dec 7, 2023
1 parent 436ca18 commit be32d8a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Pyvis/Pyvis_Visualize_awesome_notebooks_network.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -262,30 +262,32 @@
"net.force_atlas_2based()\n",
"\n",
"# Pull data\n",
"tools = list(df_temp['tool'])\n",
"images = list(df_temp['image_url'])\n",
"notebooks = list(df_temp['notebook'])\n",
"tools = df_temp['tool'].tolist()\n",
"images = df_temp['image_url'].tolist()\n",
"notebooks = df_temp['notebook'].tolist()\n",
"\n",
"# Create a dictionary of tools and images\n",
"tool_img = dict(zip(tools, images))\n",
"\n",
"# Add tool nodes\n",
"for tool in tools:\n",
"for tool in set(tools):\n",
" if tool == 'Naas':\n",
" net.add_node(tool, title=tool, image=tool_img[tool], shape='image', mass=30, size=150, level=1, fixed=True, x=0, y=0,physics=False)\n",
" if tool == 'OpenAI':\n",
" #this large node was bouncing around very fast, so I fixed it\n",
" # We set Naas as the center node\n",
" net.add_node(tool, title=tool, image=tool_img[tool], shape='image', mass=30, size=150, level=1, fixed=True, x=0, y=0, physics=False)\n",
" elif tool == 'OpenAI':\n",
" # OpenAI is a large node bouncing around very fast, so we let it be fixed\n",
" net.add_node(tool, title=tool, image=tool_img[tool], shape='image', size=60, level=1, fixed=True, x=-1000, y=2000, physics=False)\n",
" else:\n",
" net.add_node(tool, title=tool, image=tool_img[tool], shape='image',size=60,level=1, physics=False)\n",
" # All other tool nodes are of the same size and freely moving\n",
" net.add_node(tool, title=tool, image=tool_img[tool], shape='image',size=60,level=1)\n",
"\n",
"# Add notebook nodes \n",
"for notebook in notebooks:\n",
" net.add_node(notebook, title=notebook, size=30,level=2,color='#4d94db')\n",
"# Add notebook nodes\n",
"for notebook in set(notebooks):\n",
" net.add_node(notebook, title=notebook, size=30, level=2, color='#4d94db')\n",
"\n",
"# Add edges\n",
"for _, node_e in df_temp.iterrows():\n",
" net.add_edge(node_e['tool'], node_e['notebook'], title=node_e['action'])\n",
" net.add_edge(node_e['tool'], node_e['notebook'], title=node_e['notebook_url'])\n",
" \n",
"level_1_count = 0\n",
"level_2_count = 0\n",
Expand Down

0 comments on commit be32d8a

Please sign in to comment.