Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.9 kB
0
Indexable
Never
# Creating a flowchart for the Work Breakdown Structure (WBS) of a backyard swimming pool project

import matplotlib.pyplot as plt

# Initialize the figure
fig, ax = plt.subplots(figsize=(10, 8))

# Turn off the axis
ax.axis('off')

# Define a function to create a box in the flowchart
def create_box(x, y, width, height, text, ax):
    rect = plt.Rectangle((x-width/2, y-height/2), width, height, fill=True, edgecolor='black', facecolor='skyblue')
    ax.add_patch(rect)
    ax.text(x, y, text, ha='center', va='center', fontsize=10)

# Define a function to connect boxes in the flowchart
def connect_boxes(x1, y1, x2, y2, ax, connection_type):
    if connection_type == 'vertical':
        ax.arrow(x1, y1-0.05, 0, y2-y1-0.1, head_width=0.1, head_length=0.05, fc='black', ec='black')
    elif connection_type == 'horizontal':
        ax.arrow(x1+0.05, y1, x2-x1-0.1, 0, head_width=0.1, head_length=0.05, fc='black', ec='black')

# Coordinates for boxes
box_positions = {
    'Preparation': (2, 6),
    'Site Preparation': (2, 5),
    'Excavation': (2, 4),
    'Framework Installation': (2, 3),
    'Plumbing and Electrical Setup': (4, 5),
    'Pool Structure': (4, 4),
    'Finishing Touches': (4, 3),
    'Equipment Setup': (6, 5),
    'Landscaping and Safety Measures': (6, 4),
    'Inspection and Completion': (6, 3)
}

# Create the boxes
for text, (x, y) in box_positions.items():
    create_box(x, y, 1.8, 0.8, text, ax)

# Connect the boxes
connect_boxes(2, 6, 2, 5, ax, 'vertical')
connect_boxes(2, 5, 2, 4, ax, 'vertical')
connect_boxes(2, 4, 2, 3, ax, 'vertical')
connect_boxes(2, 5, 4, 5, ax, 'horizontal')
connect_boxes(4, 5, 4, 4, ax, 'vertical')
connect_boxes(4, 4, 4, 3, ax, 'vertical')
connect_boxes(4, 5, 6, 5, ax, 'horizontal')
connect_boxes(6, 5, 6, 4, ax, 'vertical')
connect_boxes(6, 4, 6, 3, ax, 'vertical')

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