Skip to content

sursingh/dotmagic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graphviz magic

Simple magic functions that adds support for dropping shadows in diagram

Install

pip install git+https://github.com/sursingh/dotmagic.git

This has a dependency on inkscape. inkscape needs to be installed for supporting rendering to png. SVG rendering should work out of the box.

Usage

%%dot -prsK <layout>
 -p: convert image to png (default SVG)
 -r: return raw svg file
 -s: drop shadows
 -K <layout>: Select the layout
    dot(default), neato, twopi, circle, fdpm sfdp

%dotstr -prsK <layout> <dotstr>

Also it will expand the local variables

Simple graph

# Load the magic
%load_ext dotmagic

style='filled'
color='lightblue'
%%dot
digraph {
    node [color="${color}" style="${style}"]
    a -> {b c}
}

png

g = '''digraph {
   node [color="${color}" style="${style}"]
    a -> {b c} 
}'''
%dotstr g

png

Adding a shadow

%%dot -s
digraph {
    node [color="${color}" style="${style}"]
    a -> {b c}
}

png

Change the layout

%%dot -sK neato
digraph {
    node [color="${color}" style="${style}"]
    a -> {b c}
}

png

About

graphviz magic for jupyter notebook

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages