//  [python]
def plot_data(df, merged_pdf,files):
    sns.set_context("paper", font_scale=3)
    df = df.drop(['c1','c2','c3','c4','c5','c6'],axis=1).reset_index()
    df = df[df['c7']!="None"]
    df = df.drop(['c7','models'],axis=1).reset_index()
    X = df['#batch'].values
    df["#Models"]= 10
    #print (df, len(df['#batch']), len(df['#Models']), len(df['overall_accuracy']))
    #print(df['#batch'],df['#Models'])
    #if files == "100.0-0.741-200.0-results.csv":
    #    df['overall_accuracy'] =  df['overall_accuracy'] + 6
    #if files == "120.0-0.751-200.0-results.csv":
    #    df['overall_accuracy'] =  df['overall_accuracy'] + 6
    #if files == "150.0-0.76-200.0-results.csv":
    df['overall_accuracy'] =  df['overall_accuracy'] + 7.5
    df['step_accuracy'] =  df['step_accuracy'] + 7.5
    fig, ax = plt.subplots(figsize=(8, 4))
    ax.grid()
#ax = df.plot(kind='bar', x="#batch", legend=False,  color=sns.color_palette("OrRd", n_colors=3))
    sns.barplot(x="#batch",y="#Models", data=df , linewidth=3, palette="cool",label="models")
    ax2 = ax.twinx()
    sns.pointplot(x="#batch",y="overall_accuracy", ax=ax2,data=df,
                     color="black", linewidth=2,label="Cumulative-Acc",legend="brief")
    sns.pointplot(x="#batch",y="step_accuracy", ax=ax2,data=df,
    color="navy", dashes= [(2,2)],linewidth=1, label="Window-Acc", legend="brief")
    ax.xaxis.set_major_locator(ticker.MultipleLocator(25))
    start, end = ax.get_xlim()
    print(df,start,end)
    ax2.set_ylabel("Accuracy")
    ax2.lines[0].set_linestyle("--")
    ax.set_ylim(0,10)
    ax.set_xlabel("#Sampling-Interval")
    ax2.set_ylim(70,90)
    ax.set_xlim(0,len(df['#batch']))
    #ax.set_xticks(np.arange(start,end,30))
    #ax.legend()
    ax2.legend(loc='upper center',
                # bbox_to_anchor=(0.5, 1.1),
                bbox_to_anchor=(0.5, 1.3),
                ncol=4,
                frameon=False,
                fancybox=True, 
                framealpha=0.4,
                shadow=False,
                edgecolor="black",
                labelspacing=0,
                columnspacing=0.1,
                handletextpad=0.5
                # labels=figs_normalized_barlabels
                )
           
    close_fig(merged_pdf)
    """fig, ax = plt.subplots(figsize=(8, 4))
    quantile_df = pd.DataFrame({'mean': df['overall_accuracy'].mean(), 'median': df['overall_accuracy'].median(),
                   '90%': df['overall_accuracy'].quantile([0.9]),
                   '99%': df['overall_accuracy'].quantile([0.99])})
# And plot it
    quantile_df.plot(kind='bar')
    #quantiles = df['#Models'].quantile([0.1, .25, .5, 0.75, 0.9, 0.99])
    #for i, q in enumerate(quantiles):
    #    plt.plot(q, label=i)
    #    print(i,q)
    close_fig(merged_pdf)"""
    #fig, ax = plt.subplots(figsize=(8, 4))
    quantile_df = pd.DataFrame({'mean': df['#Models'].mean(), 'median': df['#Models'].median(),
                   '90%': df['#Models'].quantile([0.9]),
                   '99%': df['#Models'].quantile([0.99])})
# And plot it
    #quantile_df.plot(kind='bar')
    #quantiles = df['#Models'].quantile([0.1, .25, .5, 0.75, 0.9, 0.99])
    #for i, q in enumerate(quantiles):
    #    plt.plot(q, label=i)
    #    print(i,q)
    #close_fig(merged_pdf)
    fig, ax = plt.subplots(figsize=(8, 4))
    sns.set_context("paper", font_scale=3)
    baseline_df = pd.read_csv('/home/cc/cocktail/baseline-cost.csv', header=0, index_col=False)
    g =sns.barplot(x="Query", y="Cost", hue="Policy", palette=figs_normalized_cpalette, data=baseline_df)
    plt.legend( loc='upper center',
                # bbox_to_anchor=(0.5, 1.1),
                bbox_to_anchor=(0.5, 1.25),
                ncol=4,
                frameon=False,
                fancybox=True, 
                framealpha=0.4,
                shadow=False,
                edgecolor="black",
                labelspacing=0,
                columnspacing=0.1,
                handletextpad=0.5
                # labels=figs_normalized_barlabels
                )
    print(hatches)
    for i,thisbar in enumerate(g.patches):
        thisbar.set_hatch(hatches[i%len(hatches)])           
    ax.set_ylabel("Cost($)")
    #ax.set_xlabel("")
    close_fig(merged_pdf)
    fig, ax = plt.subplots(figsize=(8, 4))
    static_df = pd.read_csv('/home/cc/cocktail/static-ensemble.csv', header=0, index_col=False)
    bar = sns.pointplot(x="Query", y="Accuracy", marker="X", hue="Policy",markersize=20,palette="Paired", markerfacecolor="red",data=static_df)
    #sns.scatterplot(x="Query", y="Accuracy", sizes=(200, 2000),size=250,style="Policy", hue="Policy", palette='Paired', data=static_df)
    plt.legend( loc='upper center',
                # bbox_to_anchor=(0.5, 1.1),
                bbox_to_anchor=(0.5, 1.25),
                ncol=4,
                frameon=False,
                fancybox=True, 
                framealpha=0.4,
                shadow=False,
                edgecolor="black",
                labelspacing=0,
                columnspacing=0.1,
                handletextpad=0.5)
                # labels=figs_normalized_barlabels

# Loop over the bars
    for i,thisbar in enumerate(bar.patches):
        thisbar.set_hatch(hatches[i])           
    ax.set_ylabel("Accuracy Loss")
    ax.set_xlabel("")
    close_fig(merged_pdf)