Skip to content

Commit

Permalink
Show source code using inspect instead of double-question marks.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmjl committed Mar 31, 2021
1 parent 393a997 commit 25c1ca3
Showing 1 changed file with 55 additions and 31 deletions.
86 changes: 55 additions & 31 deletions docs/api/facet-api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "reserved-madrid",
"id": "powered-wales",
"metadata": {},
"source": [
"# Panels and Faceting\n",
Expand All @@ -13,7 +13,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "future-waste",
"id": "equal-mechanics",
"metadata": {
"tags": []
},
Expand All @@ -27,7 +27,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "regional-cincinnati",
"id": "distinct-cloud",
"metadata": {
"tags": []
},
Expand All @@ -44,7 +44,7 @@
},
{
"cell_type": "markdown",
"id": "dramatic-channel",
"id": "driving-lawsuit",
"metadata": {},
"source": [
"## Example graph\n",
Expand All @@ -55,7 +55,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "intended-accordance",
"id": "funny-scholarship",
"metadata": {
"tags": []
},
Expand All @@ -76,7 +76,7 @@
},
{
"cell_type": "markdown",
"id": "mobile-pollution",
"id": "developed-backup",
"metadata": {},
"source": [
"## Non-panel'd version\n",
Expand All @@ -87,7 +87,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "acquired-friendly",
"id": "peaceful-cursor",
"metadata": {
"tags": []
},
Expand All @@ -104,7 +104,7 @@
},
{
"cell_type": "markdown",
"id": "public-abortion",
"id": "japanese-prospect",
"metadata": {},
"source": [
"This isn't particularly useful.\n",
Expand All @@ -117,7 +117,7 @@
},
{
"cell_type": "markdown",
"id": "starting-client",
"id": "dying-trader",
"metadata": {},
"source": [
"## `nxviz` faceting API\n",
Expand All @@ -138,20 +138,21 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ultimate-pharmaceutical",
"id": "sunset-collection",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from nxviz import annotate, facet\n",
"\n",
"# from nxviz import hive_panel, arc_panel, circos_panel\n",
"from nxviz.utils import edge_table, node_table"
]
},
{
"cell_type": "markdown",
"id": "affecting-lindsay",
"id": "future-detection",
"metadata": {},
"source": [
"### Arc Panel"
Expand All @@ -160,18 +161,24 @@
{
"cell_type": "code",
"execution_count": null,
"id": "concerned-magic",
"id": "oriental-amsterdam",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"facet.arc_panel(G, edge_group_by=\"group\", node_group_by=\"category\", node_color_by=\"category\", edge_color_by=\"edge_val\")"
"facet.arc_panel(\n",
" G,\n",
" edge_group_by=\"group\",\n",
" node_group_by=\"category\",\n",
" node_color_by=\"category\",\n",
" edge_color_by=\"edge_val\",\n",
")"
]
},
{
"cell_type": "markdown",
"id": "expanded-disposition",
"id": "instrumental-burns",
"metadata": {},
"source": [
"### Circos Panel"
Expand All @@ -180,18 +187,24 @@
{
"cell_type": "code",
"execution_count": null,
"id": "expected-supplier",
"id": "proud-glass",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"facet.circos_panel(G, edge_group_by=\"group\", node_group_by=\"category\", node_color_by=\"category\", edge_color_by=\"edge_val\")"
"facet.circos_panel(\n",
" G,\n",
" edge_group_by=\"group\",\n",
" node_group_by=\"category\",\n",
" node_color_by=\"category\",\n",
" edge_color_by=\"edge_val\",\n",
")"
]
},
{
"cell_type": "markdown",
"id": "interstate-calendar",
"id": "floating-charger",
"metadata": {},
"source": [
"### Matrix Panel"
Expand All @@ -200,16 +213,22 @@
{
"cell_type": "code",
"execution_count": null,
"id": "handed-cisco",
"id": "fossil-component",
"metadata": {},
"outputs": [],
"source": [
"facet.matrix_panel(G, edge_group_by=\"group\", node_group_by=\"category\", node_color_by=\"category\", edge_color_by=\"edge_val\")"
"facet.matrix_panel(\n",
" G,\n",
" edge_group_by=\"group\",\n",
" node_group_by=\"category\",\n",
" node_color_by=\"category\",\n",
" edge_color_by=\"edge_val\",\n",
")"
]
},
{
"cell_type": "markdown",
"id": "graduate-default",
"id": "waiting-projector",
"metadata": {},
"source": [
"### Hive Panel\n",
Expand All @@ -227,7 +246,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "hispanic-crossing",
"id": "unlike-approval",
"metadata": {
"tags": []
},
Expand All @@ -238,7 +257,7 @@
},
{
"cell_type": "markdown",
"id": "concerned-munich",
"id": "administrative-pricing",
"metadata": {},
"source": [
"## Custom panels\n",
Expand All @@ -257,20 +276,23 @@
{
"cell_type": "code",
"execution_count": null,
"id": "tight-pollution",
"id": "thorough-dominican",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from nxviz.facet import node_group_edges, n_rows_cols\n",
"node_group_edges??"
"import inspect\n",
"\n",
"from nxviz.facet import n_rows_cols, node_group_edges\n",
"\n",
"print(inspect.getsource(node_group_edges))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "military-origin",
"id": "heavy-formula",
"metadata": {
"tags": []
},
Expand All @@ -291,7 +313,7 @@
" annotate.circos_group(G_sub, group_by=\"category\")\n",
" ax.set_title(f\"node group = {group}\")\n",
"\n",
" \n",
"\n",
"i = axes.index(ax)\n",
"for ax in axes[i + 1 :]:\n",
" fig.delaxes(ax)\n",
Expand All @@ -301,7 +323,7 @@
},
{
"cell_type": "markdown",
"id": "quantitative-nowhere",
"id": "devoted-reaction",
"metadata": {},
"source": [
"## Development pattern\n",
Expand All @@ -319,18 +341,20 @@
{
"cell_type": "code",
"execution_count": null,
"id": "helpful-integration",
"id": "answering-tender",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"facet.edge_group??"
"import inspect\n",
"\n",
"print(inspect.getsource(facet.edge_group))"
]
},
{
"cell_type": "markdown",
"id": "cloudy-carbon",
"id": "several-sewing",
"metadata": {},
"source": [
"The pattern is essentially to identify the exact groups that exist,\n",
Expand Down

0 comments on commit 25c1ca3

Please sign in to comment.