Advertisement
Derik_hacker

Untitled

Mar 26th, 2025
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. from graphviz import Digraph
  2. import matplotlib.pyplot as plt
  3. import matplotlib.image as mpimg
  4.  
  5. # Create Graphviz Digraph
  6. dot = Digraph(comment='Heat-CVD Pathways', format='png', graph_attr={'rankdir': 'LR'})
  7. dot.attr('node', shape='box', style='rounded', color='black')
  8.  
  9. # Nodes
  10. dot.node('Heat', 'Extreme Heat', fillcolor='#ff6b6b', style='filled')
  11. dot.node('Thermo', 'Thermoregulatory Stress\n↑ Core Temp\n(Aging Effects)', fillcolor='#a6d8f7')
  12. dot.node('Dehyd', 'Dehydration\n↓ Blood Volume\n↑ Viscosity', fillcolor='#a6d8f7')
  13. dot.node('Gut', 'Gut Hypoperfusion\nEndotoxin Leak', fillcolor='#a6d8f7')
  14. dot.node('Ox', 'Oxidative Stress\n↑ ROS / ↓ NO', fillcolor='#a6d8f7')
  15. dot.node('CVD', 'Cardiovascular Disease\n• Stroke\n• MI\n• Heart Failure', fillcolor='#ff0000', fontcolor='white', style='filled')
  16.  
  17. # Edges
  18. dot.edge('Heat', 'Thermo', label='↑ Cutaneous Blood Flow')
  19. dot.edge('Heat', 'Dehyd', label='Sweating/Fluid Loss')
  20. dot.edge('Heat', 'Gut', label='↓ Splanchnic Flow')
  21. dot.edge('Heat', 'Ox', label='Mitochondrial Stress')
  22. dot.edge('Thermo', 'CVD', label='Cardiac Strain')
  23. dot.edge('Dehyd', 'CVD', label='Thrombosis')
  24. dot.edge('Gut', 'CVD', label='Inflammation → Atherosclerosis')
  25. dot.edge('Ox', 'CVD', label='Endothelial Dysfunction')
  26.  
  27. # Render and Save Graph
  28. file_path = 'heat_cvd_flowchart.png'
  29. dot.render('heat_cvd_flowchart', format='png', cleanup=True)
  30.  
  31. # Display the Graph using Matplotlib
  32. img = mpimg.imread(file_path)
  33. plt.figure(figsize=(10, 5))
  34. plt.imshow(img)
  35. plt.axis('off')  # Hide axes
  36. plt.show()
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement