Skip to content

Commit

Permalink
reverted change to write html name generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
BerserkerGaruk committed Feb 6, 2023
1 parent c40cd82 commit 5fbe88d
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 14 deletions.
177 changes: 164 additions & 13 deletions notebooks/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
" <iframe\n",
" width=\"100%\"\n",
" height=\"600px\"\n",
" src=\"/home/mpscherer/pyvis/pyvis/notebooks/example.html\"\n",
" src=\"example.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f384c2d7d00>"
"<IPython.lib.display.IFrame at 0x7f0ecc790ee0>"
]
},
"execution_count": 2,
Expand Down Expand Up @@ -81,14 +81,45 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"scrolled": true
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Warning: When cdn_resources is 'local' jupyter notebook has issues displaying graphics on chrome/safari. Use cdn_resources='in_line' or cdn_resources='remote' if you have issues viewing graphics in a notebook.\n",
"dot.html\n"
]
},
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"600px\"\n",
" src=\"dot.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f0e7c5d7f10>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"h = Network(notebook=True)\n",
"h.from_DOT(\"test.dot\")\n",
Expand Down Expand Up @@ -138,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {
"pycharm": {
"name": "#%%\n"
Expand All @@ -151,14 +182,44 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"scrolled": true
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"example2.html\n"
]
},
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"600px\"\n",
" src=\"example2.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f0ecc651df0>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nxg = nx.random_tree(20)\n",
"g.from_nx(nxg)\n",
Expand All @@ -178,13 +239,43 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"example3.html\n"
]
},
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"600px\"\n",
" src=\"example3.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f0e7c6208b0>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g.toggle_physics(False)\n",
"g.show(\"example3.html\")"
Expand All @@ -203,13 +294,43 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"example4.html\n"
]
},
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"600px\"\n",
" src=\"example4.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f0e7c62c250>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g = Network(notebook=True,cdn_resources='remote')\n",
"g.add_nodes([1,2,3],\n",
Expand Down Expand Up @@ -242,14 +363,44 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"pycharm": {
"name": "#%%\n"
},
"scrolled": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"example5.html\n"
]
},
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"750px\"\n",
" src=\"example5.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f0ecc790fd0>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion pyvis/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def write_html(self, name, local=True, notebook=False,open_browser=False):
@param notebook: If true, this object will return the iframe document for use in juptyer notebook.
@param open_browser: If true, will open a web browser with the generated graph.
"""
getcwd_name = os.getcwd() + "/" + name
getcwd_name = name
check_html(getcwd_name)
self.html = self.generate_html(notebook=notebook)

Expand Down

0 comments on commit 5fbe88d

Please sign in to comment.