Untitled

 avatar
unknown
plain_text
5 days ago
1.2 kB
3
Indexable
import matplotlib.pyplot as plt

# Create figure and axis
fig, ax = plt.subplots(figsize=(6, 6))
ax.set_xlim(-2, 2)
ax.set_ylim(0, 5)
ax.axis("off")

# Define positions for family members
positions = {
    "Father": ( -1, 4),
    "Mother": ( 1, 4),
    "Teenage Son": (-1, 3),
    "Young Daughter": (1, 3),
    "Grandmother": (0, 2)
}

# Draw family members
for name, (x, y) in positions.items():
    ax.text(x, y, name, fontsize=12, ha="center", bbox=dict(facecolor="lightblue", edgecolor="black", boxstyle="round,pad=0.3"))

# Draw subsystem connections with lines
connections = [
    ("Father", "Mother"),  # Marital Subsystem
    ("Father", "Teenage Son"), ("Mother", "Young Daughter"),  # Parental Subsystem
    ("Teenage Son", "Young Daughter"),  # Sibling Subsystem
    ("Grandmother", "Young Daughter"),  # Grandparent-Grandchild Subsystem
    ("Grandmother", "Father"), ("Grandmother", "Mother")  # Extended Family Subsystem
]

for person1, person2 in connections:
    x1, y1 = positions[person1]
    x2, y2 = positions[person2]
    ax.plot([x1, x2], [y1, y2], "k-", linewidth=1)

# Title
ax.set_title("Simple Family Subsystems Diagram", fontsize=14)

# Show the diagram
plt.show()
Leave a Comment