Untitled

 avatar
unknown
plain_text
a month ago
1.3 kB
1
Indexable
import matplotlib.pyplot as plt

# Function to create Darrow-Yannet diagram
def draw_darrow_yannet_diagram():
    # Normal state (baseline)
    normal_ecf = [0, 10, 10, 0, 0]
    normal_icf = [10, 20, 20, 10, 10]
    normal_height = [10, 10, 20, 20, 10]

    # Isotonic dehydration state
    dehydrated_ecf = [0, 8, 8, 0, 0]  # ECF volume decreases
    dehydrated_icf = [10, 20, 20, 10, 10]  # ICF remains unchanged
    dehydrated_height = [10, 10, 20, 20, 10]  # Osmolality unchanged

    # Plot the normal state
    plt.fill(normal_ecf, normal_height, color='skyblue', alpha=0.5, label='Normal ECF')
    plt.fill(normal_icf, normal_height, color='lightgreen', alpha=0.5, label='Normal ICF')

    # Plot the dehydrated state
    plt.fill(dehydrated_ecf, dehydrated_height, color='blue', alpha=0.7, label='Dehydrated ECF')
    plt.fill(dehydrated_icf, dehydrated_height, color='green', alpha=0.7, label='Dehydrated ICF')

    # Add labels and title
    plt.title("Darrow-Yannet Diagram: Isotonic Dehydration")
    plt.xlabel("Compartments (ECF & ICF)")
    plt.ylabel("Osmolality & Volume")
    plt.legend()
    plt.grid(axis='y', linestyle='--', alpha=0.6)
    plt.show()

# Draw the diagram
draw_darrow_yannet_diagram()
Leave a Comment