Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from graphviz import Digraph
- import matplotlib.pyplot as plt
- import matplotlib.image as mpimg
- # Create Graphviz Digraph
- dot = Digraph(comment='Heat-CVD Pathways', format='png', graph_attr={'rankdir': 'LR'})
- dot.attr('node', shape='box', style='rounded', color='black')
- # Nodes
- dot.node('Heat', 'Extreme Heat', fillcolor='#ff6b6b', style='filled')
- dot.node('Thermo', 'Thermoregulatory Stress\n↑ Core Temp\n(Aging Effects)', fillcolor='#a6d8f7')
- dot.node('Dehyd', 'Dehydration\n↓ Blood Volume\n↑ Viscosity', fillcolor='#a6d8f7')
- dot.node('Gut', 'Gut Hypoperfusion\nEndotoxin Leak', fillcolor='#a6d8f7')
- dot.node('Ox', 'Oxidative Stress\n↑ ROS / ↓ NO', fillcolor='#a6d8f7')
- dot.node('CVD', 'Cardiovascular Disease\n• Stroke\n• MI\n• Heart Failure', fillcolor='#ff0000', fontcolor='white', style='filled')
- # Edges
- dot.edge('Heat', 'Thermo', label='↑ Cutaneous Blood Flow')
- dot.edge('Heat', 'Dehyd', label='Sweating/Fluid Loss')
- dot.edge('Heat', 'Gut', label='↓ Splanchnic Flow')
- dot.edge('Heat', 'Ox', label='Mitochondrial Stress')
- dot.edge('Thermo', 'CVD', label='Cardiac Strain')
- dot.edge('Dehyd', 'CVD', label='Thrombosis')
- dot.edge('Gut', 'CVD', label='Inflammation → Atherosclerosis')
- dot.edge('Ox', 'CVD', label='Endothelial Dysfunction')
- # Render and Save Graph
- file_path = 'heat_cvd_flowchart.png'
- dot.render('heat_cvd_flowchart', format='png', cleanup=True)
- # Display the Graph using Matplotlib
- img = mpimg.imread(file_path)
- plt.figure(figsize=(10, 5))
- plt.imshow(img)
- plt.axis('off') # Hide axes
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement