Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #2443 pyvis three minor enhancements #2444

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 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",
"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
Loading