{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ipycytoscape" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import json\n", "with open(\"gridData.json\") as fi:\n", " json_file = json.load(fi)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cytoscapeobj = ipycytoscape.CytoscapeWidget()\n", "cytoscapeobj.graph.add_graph_from_json(json_file)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cytoscapeobj.set_layout(name='grid')\n", "cytoscapeobj.set_style([{\n", " \"selector\":\"node\",\n", " \"style\":{\n", " \"height\":20,\n", " \"width\":20,\n", " \"background-color\":\"#18e018\"\n", " }\n", " },\n", " {\n", " \"selector\":\"edge\",\n", " \"style\":{\n", " \"curve-style\":\"haystack\",\n", " \"haystack-radius\":0,\n", " \"width\":5,\n", " \"opacity\":0.5,\n", " \"line-color\":\"#a2efa2\"\n", " }\n", " }])\n", "cytoscapeobj" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }