Untitled

 avatar
unknown
plain_text
a year ago
1.8 kB
5
Indexable
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.lines import Line2D

# Create a new figure
fig, ax = plt.subplots(figsize=(10, 8))

# Define positions for the boxes
positions = {
    "Hand Washing and Sanitizing": (0.5, 0.9),
    "Sterilization of Equipment": (0.5, 0.75),
    "Disinfecting Work Surfaces": (0.5, 0.6),
    "Flame Sterilization": (0.5, 0.45),
    "Proper Handling of Culture Media": (0.5, 0.3),
    "Use of Protective Clothing": (0.3, 0.15),
    "Minimizing Exposure": (0.7, 0.15),
    "Use of Laminar Flow Hoods": (0.5, 0.0)
}

# Define the connections between the boxes
connections = [
    ("Hand Washing and Sanitizing", "Sterilization of Equipment"),
    ("Sterilization of Equipment", "Disinfecting Work Surfaces"),
    ("Disinfecting Work Surfaces", "Flame Sterilization"),
    ("Flame Sterilization", "Proper Handling of Culture Media"),
    ("Proper Handling of Culture Media", "Use of Protective Clothing"),
    ("Proper Handling of Culture Media", "Minimizing Exposure"),
    ("Use of Protective Clothing", "Use of Laminar Flow Hoods"),
    ("Minimizing Exposure", "Use of Laminar Flow Hoods")
]

# Create the boxes and arrows
for key, pos in positions.items():
    ax.text(pos[0], pos[1], key, ha='center', va='center', fontsize=12,
            bbox=dict(boxstyle="round,pad=0.3", edgecolor="black", facecolor="lightblue"))
    
for start, end in connections:
    start_pos = positions[start]
    end_pos = positions[end]
    ax.annotate('', xy=end_pos, xytext=start_pos,
                arrowprops=dict(arrowstyle="->", lw=2))

# Set the axis limits and remove the axes
ax.set_xlim(0, 1)
ax.set_ylim(-0.1, 1)
ax.axis('off')

# Show the plot
plt.show()
Editor is loading...
Leave a Comment