Skip to content

Instantly share code, notes, and snippets.

@ten0s ten0s/ibash_graphviz.ipynb
Last active Jul 23, 2016

Embed
What would you like to do?
Display graphviz dot in Jupyter using IBash kernel
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": []
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAFMAAACbCAYAAAAeCafZAAAABmJLR0QA/wD/AP+gvaeTAAAMOUlEQVR4nO2da0yT1x/Hv70AlYuwQrsArUyHtUCNmG0ZXWCaTTcdaAQCk3mZS3SLIUMTNpuwhOmWvRgZMt0Ll2XJ5pZlm8w4s0Xj3DKFVJ0i2eoVujCgQHACUqPQ0svv/8K/xNkLhZ72acn5JL6o5/R5vv2kF+A5p18RERE4LGgWC51gNsFlMoTLZIhU6AAP4nQ6cePGDfT09GBsbAzj4+Ow2WyT43PnzoVEIoFSqURmZiZSU1MFTOuJIDLtdjva2tpw6dIlXL58GVeuXIHZbMbg4CBcLlfAx5kzZw7UajVycnKQl5eHxYsXIz8/H1qtNoTpfSMKx6e52+3GmTNncPz4cbS2tuLChQuw2WxQKBTQarXQarXIzs6GWq2GWq3GvHnzkJSU5PVYRITBwUH09fWhr68PPT096OjomPw3Pj4OpVKJwsJCLF++HGvWrMFjjz0W6ocIAM2gEPL777/T1q1bSalUEgDSarW0fft2+u6772hgYID5+VwuF/3111+0f/9+Ki8vp9TUVAJA+fn5tGfPHurt7WV+zgc4xFzmnTt36MCBA6TT6QgALV26lD744AO6du0a61NNicPhoJMnT9L27dtJqVSSRCKhsrIy+u2330JxOnYyR0ZGyGAwUFJSEsnlcjIYDHT9+nVWhw8al8tFJ0+epIqKCpJIJKTT6ejgwYPkcrlYnSJ4mS6Xiz777DNSKBSUkpJC9fX1NDw8zCJcyGhvb6fS0lISiUSk1+upvb2dxWGDk2kymeiZZ56h2NhYqquro9HRURahwobJZKIVK1aQRCKhmpoaun37djCHm5lMt9tNH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95gzg/eYM4P3mDOD95kHC+82DhPebzxDeb877zdnC+805vuD95izhMhnCZTJECqBZ6BCzhHP/A5fVWGykDAxUAAAAAElFTkSuQmCC"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"echo \"\n",
"\n",
"digraph {\n",
" a -> b\n",
"}\n",
"\n",
"\" | dot -Tpng | display"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": []
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAFMAAACbCAYAAAAeCafZAAAABmJLR0QA/wD/AP+gvaeTAAAMOUlEQVR4nO2da0yT1x/Hv70AlYuwQrsArUyHtUCNmG0ZXWCaTTcdaAQCk3mZS3SLIUMTNpuwhOmWvRgZMt0Ll2XJ5pZlm8w4s0Xj3DKFVJ0i2eoVujCgQHACUqPQ0svv/8K/xNkLhZ72acn5JL6o5/R5vv2kF+A5p18RERE4LGgWC51gNsFlMoTLZIhU6AAP4nQ6cePGDfT09GBsbAzj4+Ow2WyT43PnzoVEIoFSqURmZiZSU1MFTOuJIDLtdjva2tpw6dIlXL58GVeuXIHZbMbg4CBcLlfAx5kzZw7UajVycnKQl5eHxYsXIz8/H1qtNoTpfSMKx6e52+3GmTNncPz4cbS2tuLChQuw2WxQKBTQarXQarXIzs6GWq2GWq3GvHnzkJSU5PVYRITBwUH09fWhr68PPT096OjomPw3Pj4OpVKJwsJCLF++HGvWrMFjjz0W6ocIAM2gEPL777/T1q1bSalUEgDSarW0fft2+u6772hgYID5+VwuF/3111+0f/9+Ki8vp9TUVAJA+fn5tGfPHurt7WV+zgc4xFzmnTt36MCBA6TT6QgALV26lD744AO6du0a61NNicPhoJMnT9L27dtJqVSSRCKhsrIy+u2330JxOnYyR0ZGyGAwUFJSEsnlcjIYDHT9+nVWhw8al8tFJ0+epIqKCpJIJKTT6ejgwYPkcrlYnSJ4mS6Xiz777DNSKBSUkpJC9fX1NDw8zCJc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bUV1djQULFuDYsWM+d2KEGuL95uzg/eYM4f3mjOD95gzh/eaM4P3mjOD95ozg/eYM4f3mDOD95ozg/eaM4P3mjOD95gzg/eYM4P3mDOD95kHC+82DhPebzxDeb877zdnC+805vuD95izhMhnCZTJECqBZ6BCzhHP/A5fVWGykDAxUAAAAAElFTkSuQmCC"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dot -Tpng << EOF | display\n",
"\n",
"digraph {\n",
" a -> b\n",
"}\n",
"\n",
"EOF"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Bash",
"language": "bash",
"name": "bash"
},
"language_info": {
"codemirror_mode": "shell",
"file_extension": ".sh",
"mimetype": "text/x-sh",
"name": "bash"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.