Rename the 'gender' coloring to be more freeform, and make it an optional field.
This commit is contained in:
parent
b8114a0016
commit
228e899b66
|
@ -1,7 +1,7 @@
|
|||
{ "members": [
|
||||
{"name": "Alice", "color": "pink"},
|
||||
{"name": "Bob", "color": "blue"},
|
||||
{"name": "Sam", "color": "green"},
|
||||
{"name": "Sam"},
|
||||
{"name": "Eve", "color": "pink"},
|
||||
{"name": "Charles", "color": "blue"},
|
||||
{"name": "Max", "color": "yellow"}
|
||||
|
|
BIN
example.png
BIN
example.png
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 18 KiB |
10
polygraph.py
10
polygraph.py
|
@ -8,7 +8,7 @@ def parse_args():
|
|||
parser = argparse.ArgumentParser(description='Generate graphs of polyamorous family networks from data files')
|
||||
parser.add_argument('--input', '-i', default='network.json', help='Input file in json format')
|
||||
parser.add_argument('--output', '-o', default='network.png', help='Output image file. Format auto-detected from file extension')
|
||||
parser.add_argument('--gender', '-g', action='store_true', help='Include gender colors in output graph')
|
||||
parser.add_argument('--color', '-c', action='store_true', help='Include node colors in output graph')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
@ -28,11 +28,11 @@ def main():
|
|||
|
||||
# Add nodes to graph
|
||||
for user in data['members']:
|
||||
gender_color = 'white'
|
||||
if settings.gender:
|
||||
gender_color = user['color']
|
||||
node_color = 'white'
|
||||
if settings.color and user.has_key('color'):
|
||||
node_color = user['color']
|
||||
|
||||
graph.add_node(user['name'], fillcolor=gender_color)
|
||||
graph.add_node(user['name'], fillcolor=node_color)
|
||||
|
||||
# Add edges to graph
|
||||
edge_style = 'solid'
|
||||
|
|
Loading…
Reference in New Issue
Block a user