import matplotlib.pyplot as plt import matplotlib.patches as patches def draw_universal_claw_clip(width_ratio=0.5): """ Draw a universal claw clip visualization. width_ratio: 0.0 (fully closed, thin hair) to 1.0 (fully open, thick/afro hair) """ fig, ax = plt.subplots(figsize=(12, 6)) ax.set_xlim(0, 14) ax.set_ylim(0, 7) ax.set_aspect('equal') ax.axis('off') clip_length = 12 * width_ratio clip_height = 2.5 # Main body body = patches.FancyBboxPatch((1, 2), clip_length, clip_height, boxstyle="round,pad=0.3", linewidth=2, edgecolor='saddlebrown', facecolor='peru') ax.add_patch(body) # Inner teeth (fine hair) num_inner_teeth = max(int(8 * width_ratio), 2) for i in range(num_inner_teeth): x = 1 + (i * clip_length / num_inner_teeth) tooth_top = patches.Rectangle((x-0.1, 4.5), 0.1, 0.5, linewidth=1, edgecolor='darkgoldenrod', facecolor='goldenrod') ax.add_patch(tooth_top) tooth_bottom = patches.Rectangle((x-0.1, 1), 0.1, 0.5, linewidth=1, edgecolor='darkgoldenrod', facecolor='goldenrod') ax.add_patch(tooth_bottom) # Outer teeth (thick/coily/afro hair) num_outer_teeth = max(int(5 * width_ratio), 2) for i in range(num_outer_teeth): if num_outer_teeth == 1: x = 1 + clip_length / 2 else: x = 1 + (i * clip_length / (num_outer_teeth - 1)) tooth_top = patches.Rectangle((x-0.15, 4.5), 0.2, 0.7, linewidth=1, edgecolor='sienna', facecolor='peru') ax.add_patch(tooth_top) tooth_bottom = patches.Rectangle((x-0.15, 0.8), 0.2, 0.7, linewidth=1, edgecolor='sienna', facecolor='peru') Mehr sehen