plot_robustness.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:nanopores 作者: mitschabaude 项目源码 文件源码
def plot_robustness(ax, fpdata, fplabels, fpcolors):    
    handles = OrderedDict() # for legend

    for data, label, color in zip(fpdata, fplabels, fpcolors):
        handle = []

        # nice painless way to iterate array:
        array = np.nditer(data, flags=['multi_index'])    
        for boolean in array:
            if boolean:
                i, j = array.multi_index
                x, y = X[i], Y[j]
                circle = plot_circle(ax, x, y, color)
                handle.append(circle)

        handles[label] = tuple(handle)

    # TODO: axis limits
    #ax.set_aspect('equal', 'datalim')
    #ax.autoscale_view(True,True,True)
    ax.set_xscale("log")#, subsx=[2,5])
    ax.set_yscale("log")#, subsy=[2,5])

    myhandles = [plt.Rectangle((0, 0), 1, 1, fc=col) for col in fpcolors]
    #ax.legend([h[0] for h in handles.values()], handles.keys(),
    ax.legend(myhandles, handles.keys(),
        #bbox_to_anchor=(0.5, 1.05), loc="lower center", borderaxespad=0.,)
        bbox_to_anchor=(0., 1.5), loc="upper left", borderaxespad=0.,)
        #handler_map={mpatches.Circle:HandlerPatch(patch_func=make_legend_ellipse)})
    ax.set_xlabel("voltage bias [V]")
    ax.set_ylabel(r"surface charge density [q/nm$^2$]")
    ax.set_xlim(xlim)
    ax.set_ylim(ylim)

# --- fixed point ---
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号