<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def log_to_ganttplot(execution_history_items):
 """ Example how to use the DataFrame representation """

    import matplotlib.pyplot as plt
    import matplotlib.dates as dates
    import numpy as np

    d = log_to_DataFrame(execution_history_items)

    # de-duplicate states and make mapping from state to idx
    unique_states, idx = np.unique(d.path_by_name, return_index=True)
    ordered_unique_states = np.array(d.path_by_name)[np.sort(idx)]
    name2idx = {k: i for i, k in enumerate(ordered_unique_states)}

    calldate = dates.date2num(d.timestamp_call.dt.to_pydatetime())
    returndate = dates.date2num(d.timestamp_return.dt.to_pydatetime())

    state2color = {'HierarchyState': 'k',
                   'ExecutionState': 'g',
                   'BarrierConcurrencyState': 'y',
                   'PreemptiveConcurrencyState': 'y'}

    fig, ax = plt.subplots(1, 1)
    ax.barh(bottom=[name2idx[k] for k in d.path_by_name], width=returndate-calldate,
            left=calldate, align='center', color=[state2color[s] for s in d.state_type], lw=0.0)
    plt.yticks(list(range(len(ordered_unique_states))), ordered_unique_states)