Simple magic functions that adds support for dropping shadows in diagram
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.
%%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
# Load the magic
%load_ext dotmagic
style='filled'
color='lightblue'
%%dot
digraph {
node [color="${color}" style="${style}"]
a -> {b c}
}
g = '''digraph {
node [color="${color}" style="${style}"]
a -> {b c}
}'''
%dotstr g
%%dot -s
digraph {
node [color="${color}" style="${style}"]
a -> {b c}
}
%%dot -sK neato
digraph {
node [color="${color}" style="${style}"]
a -> {b c}
}