render.py 文件源码

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

项目:picasso 作者: jungmannlab 项目源码 文件源码
def calculate_histogram(self):
        slice = self.pick_slice.value()
        ax = self.figure.add_subplot(111)
        ax.hold(False)
        plt.cla()
        n_channels = len(self.zcoord)

        hues = np.arange(0, 1, 1 / n_channels)
        self.colors = [colorsys.hsv_to_rgb(_, 1, 1) for _ in hues]

        self.bins = np.arange(np.amin(np.hstack(self.zcoord)),np.amax(np.hstack(self.zcoord)),slice)
        self.patches = []
        ax.hold(True)
        for i in range(len(self.zcoord)):
            n, bins, patches = plt.hist(self.zcoord[i], self.bins, normed=1, facecolor=self.colors[i], alpha=0.5)
            self.patches.append(patches)

        plt.xlabel('Z-Coordinate [nm]')
        plt.ylabel('Counts')
        plt.title(r'$\mathrm{Histogram\ of\ Z:}$')
        # refresh canvas
        self.canvas.draw()
        self.sl.setMaximum(len(self.bins)-2)
        #self.sl.setValue(np.ceil((len(self.bins)-2)/2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号