Created
February 4, 2019 23:23
-
-
Save yvan-sraka/cc1a07d6a00664344e2dbf2298635262 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# angles.py - http://www.graphviz.org/Gallery/gradient/angles.html | |
from graphviz import Digraph | |
g = Digraph('G', filename='angles.gv') | |
g.attr(bgcolor='blue') | |
with g.subgraph(name='cluster_1') as c: | |
c.attr(fontcolor='white') | |
c.attr('node', shape='circle', style='filled', fillcolor='white:black', | |
gradientangle='360', label='n9:360', fontcolor='black') | |
c.node('n9') | |
for i, a in zip(range(8, 0, -1), range(360 - 45, -1, -45)): | |
c.attr('node', gradientangle='%d' % a, label='n%d:%d' % (i, a)) | |
c.node('n%d' % i) | |
c.attr(label='Linear Angle Variations (white to black gradient)') | |
with g.subgraph(name='cluster_2') as c: | |
c.attr(fontcolor='white') | |
c.attr('node', shape='circle', style='radial', fillcolor='white:black', | |
gradientangle='360', label='n18:360', fontcolor='black') | |
c.node('n18') | |
for i, a in zip(range(17, 9, -1), range(360 - 45, -1, -45)): | |
c.attr('node', gradientangle='%d' % a, label='n%d:%d' % (i, a)) | |
c.node('n%d' % i) | |
c.attr(label='Radial Angle Variations (white to black gradient)') | |
g.edge('n5', 'n14') | |
g.view() | |
_images/angles.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.graphviz.org/Gallery/gradient/g_c_n.html | |
from graphviz import Graph | |
g = Graph('G', filename='g_c_n.gv') | |
g.attr(bgcolor='purple:pink', label='agraph', fontcolor='white') | |
with g.subgraph(name='cluster1') as c: | |
c.attr(fillcolor='blue:cyan', label='acluster', fontcolor='white', | |
style='filled', gradientangle='270') | |
c.attr('node', shape='box', fillcolor='red:yellow', | |
style='filled', gradientangle='90') | |
c.node('anode') | |
g.view() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment