from conjuror.plans.truebeam import DosimetricLeafGap, TrueBeamMachine

procedure = DosimetricLeafGap(gap_widths=(2, 20))
machine = TrueBeamMachine(mlc_is_hd=False)
procedure.compute(machine)

beam = procedure.beams[1]  # 20 mm gap
fig = beam.animate_mlc(show=False)
pad = 30
fig.update_layout(
    xaxis_scaleanchor="y",
    xaxis_range=[procedure.x1 - pad, procedure.x2 + pad],
    yaxis_range=[procedure.y1 - pad, procedure.y2 + pad],
    margin=dict(l=10, r=10, t=30, b=10),
)
fig