{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "The data in this example represents Facebook social circle obtained from [SNAP](http://snap.stanford.edu/data/egonets-Facebook.html).\n", "\n", "Most examples work across multiple plotting backends, this example is also available for:\n", "\n", "* [Matplotlib network_graph](../matplotlib/network_graph.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import holoviews as hv\n", "hv.extension('bokeh')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Declaring data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "edges_df = pd.read_csv('../../../assets/fb_edges.csv')\n", "nodes_df = pd.read_csv('../../../assets/fb_nodes.csv')\n", "\n", "fb_nodes = hv.Nodes(nodes_df).sort()\n", "fb_graph = hv.Graph((edges_df, fb_nodes), label='Facebook Circles')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "colors = ['#000000']+hv.Cycle('Category20').values\n", "fb_graph = fb_graph.redim.range(x=(-0.05, 1.05), \n", " y=(-0.05, 1.05)\n", " )\n", "fb_graph.opts(color_index='circle', width=800, height=800, show_frame=False,\n", " xaxis=None, yaxis=None,node_size=10, edge_line_width=1, cmap=colors)" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }