Python seaborn regplot非连续拟合问题

Python seaborn regplot非连续拟合问题,python,pandas,numpy,matplotlib,seaborn,Python,Pandas,Numpy,Matplotlib,Seaborn,当我使用regplot绘制和拟合多组数据时,regplot函数在多次迭代后无法拟合,结果如下所示。但是,当我从上述数据中只选择一组数据时,拟合和绘图就起作用了。有人能告诉我为什么会这样以及如何解决吗 另外,我尝试了lmplot(),同样的结果 代码: def generate_regplot(df, x, y, col, hue): col_order = np.unique(df[col]) col_order = list(col_order) col_

当我使用regplot绘制和拟合多组数据时,regplot函数在多次迭代后无法拟合,结果如下所示。但是,当我从上述数据中只选择一组数据时,拟合和绘图就起作用了。有人能告诉我为什么会这样以及如何解决吗

另外,我尝试了lmplot(),同样的结果

代码:

def generate_regplot(df, x, y, col, hue):
    col_order = np.unique(df[col])
    col_order = list(col_order)     
    col_order.sort(reverse=True)
    g = sns.FacetGrid(df, col=col, col_order=col_order, hue=hue, height=8, aspect=.2)
    g = g.map (sns.regplot, x, y, order=5, scatter_kws=({'s': 0.1}))

def generate_regplot(df, x, y, col, hue):
    col_order = np.unique(df[col])
    col_order = list(col_order)      
    col_order.sort(reverse=True)
    g = sns.FacetGrid(df, col=col, col_order=col_order, hue=hue, height=8, aspect=.2)
    g = g.map (sns.regplot, x, y, order=5, scatter_kws=({'s': 0.1}))
    g = generate_regplot(df=df, x='Radius', y='Plot_CD', col='Wordline', hue=hue)
    g.axes[0][0].set_ylabel("CD [nm]", fontsize=18)

    for ax in g.axes.flat:
        ax.set_xlim(plt_rad_min, plt_rad_max)
        ax.set_ylim(plt_y_min, plt_y_max)
        ax.set_xlabel("Radius", fontsize=18)
        ax.set_xticks(x_tick_locs_rad)
        ax.set_xticklabels(x_tick_locs_rad, rotation=90)
        ax = draw_spec_lines(ax, upper_spec_lim, lower_spec_lim, punch_spec_lim)
    plt.subplots_adjust(top=0.9)
    plt.legend(title=legend_title_parse(hue), markerscale = 20, fontsize='large', title_fontsize='16', loc='upper center', bbox_to_anchor=(1.45, 1))
    plt.draw()

    return g