def METHOD_NAME(emg_signals, x_axis, onsets, offsets, sampling_rate):
    try:
        import plotly.graph_objects as go
        from plotly.subplots import make_subplots
    except ImportError:
        raise ImportError(
            "NeuroKit error: emg_plot(): the 'plotly' "
            "module is required for this feature."
            "Please install it first (`pip install plotly`)."
        )
    # Prepare figure.
    fig = make_subplots(rows=2, cols=1, shared_xaxes=True)
    fig.update_layout(title="Electromyography (EMG)", font=dict(size=18), height=600)
    # Plot cleaned and raw EMG.
    fig.add_trace(
        go.Scatter(
            x=x_axis,
            y=emg_signals["EMG_Raw"],
            mode="lines",
            name="Raw",
            line=dict(color="#B0BEC5"),
        ),
        row=1,
        col=1,
    )
    fig.add_trace(
        go.Scatter(
            x=x_axis,
            y=emg_signals["EMG_Clean"],
            mode="lines",
            name="Cleaned",
            line=dict(color="#FFC107"),
        ),
        row=1,
        col=1,
    )
    # Plot Amplitude.
    fig.add_trace(
        go.Scatter(
            x=x_axis,
            y=emg_signals["EMG_Amplitude"],
            mode="lines",
            name="Amplitude",
            line=dict(color="#FF9800"),
        ),
        row=2,
        col=1,
    )
    # Mark onsets and offsets.
    fig.add_trace(
        go.Scatter(
            x=x_axis[onsets],
            y=emg_signals["EMG_Amplitude"][onsets],
            mode="markers",
            name="Onsets",
            marker=dict(color="#f03e65", size=10),
        ),
        row=2,
        col=1,
    )
    fig.add_trace(
        go.Scatter(
            x=x_axis[offsets],
            y=emg_signals["EMG_Amplitude"][offsets],
            mode="markers",
            name="Offsets",
            marker=dict(color="#f03e65", size=10),
        ),
        row=2,
        col=1,
    )
    if sampling_rate is not None:
        onsets = onsets / sampling_rate
        offsets = offsets / sampling_rate
        fig.update_xaxes(title_text="Time (seconds)", row=2, col=1)
    elif sampling_rate is None:
        fig.update_xaxes(title_text="Samples", row=2, col=1)
    for i, j in zip(list(onsets), list(offsets)):
        fig.add_shape(
            type="line",
            x0=i,
            y0=0,
            x1=i,
            y1=1,
            line=dict(color="#4a4a4a", width=2, dash="dash"),
            row=2,
            col=1,
        )
        fig.add_shape(
            type="line",
            x0=j,
            y0=0,
            x1=j,
            y1=1,
            line=dict(color="#4a4a4a", width=2, dash="dash"),
            row=2,
            col=1,
        )
    fig.update_yaxes(title_text="Amplitude", row=2, col=1)
    return fig