schematic

 avatar
unknown
html
12 days ago
1.8 kB
2
Indexable
import matplotlib.pyplot as plt
import matplotlib.patches as patches

def draw_experiment(ax, title, steps, start_pos):
    ax.text(start_pos[0], start_pos[1] + 0.5, title, fontsize=12, fontweight='bold', ha='center')
    for i, step in enumerate(steps):
        ax.text(start_pos[0], start_pos[1] - (i + 1) * 0.5, f"{i + 1}. {step}", fontsize=10, ha='center')
        if i > 0:
            ax.annotate('', xy=(start_pos[0], start_pos[1] - (i + 0.5) * 0.5), xytext=(start_pos[0], start_pos[1] - (i) * 0.5),
                         arrowprops=dict(arrowstyle='->', lw=1.5))

# Create a figure and axis
fig, ax = plt.subplots(figsize=(10, 10))
ax.set_xlim(0, 10)
ax.set_ylim(-10, 1)
ax.axis('off')

# Experiment A: Water as Universal Solvent
steps_A = [
    "Prepare 6 test tubes: NaCl, Sugar, Gelatin, CuSO4, Lard, Ethanol",
    "Add 1 ml of water to each test tube",
    "Shake and observe solubility",
    "Add another 1 ml of water if needed"
]
draw_experiment(ax, "A. Water as Universal Solvent", steps_A, (2, 0))

# Experiment B: Water as Good Medium for Biochemical Reactions
steps_B = [
    "Prepare 1 test tube",
    "Add 0.1 g Citric Acid and 0.1 g Sodium Bicarbonate",
    "Observe any reaction",
    "Add 10 ml of water and observe"
]
draw_experiment(ax, "B. Water as Good Medium for Biochemical Reactions", steps_B, (5, 0))

# Experiment C: Properties of Water Solutions
steps_C = [
    "Dialysis: Soak bag, fill with NaCl-starch solution",
    "Osmosis: Prepare thistle tube, fill with sugar solution",
    "Diffusion: Prepare petri dish, add potassium permanganate"
]
draw_experiment(ax, "C. Properties of Water Solutions", steps_C, (8, 0))

# Show the plot
plt.title("Schematic Diagram of Experiments", fontsize=14, fontweight='bold')
plt.show()
Leave a Comment