wxplot.py 文件源码

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

项目:cebl 作者: idfah 项目源码 文件源码
def draw(self, data, t=None, scale=None, chanNames=None,
             colors=('black', 'red', 'violet', 'blue', 'green', 'orange'),
             #colors=('black', 'blue', 'green', 'red', 'turquoise', 'blue violet', 'maroon', 'orange'),
             wxYield=False):

        data = util.colmat(data)
        nObs, nChan = data.shape

        if t is None:
            t = np.arange(nObs)
        else:
            t = np.linspace(0,t,nObs)

        colsep = util.colsep(data, scale=scale)
        scale = colsep[1]

        yMin = scale * (-nChan + 0.5)
        yMax = scale * 0.5

        data = data - colsep

        if chanNames is None:
            chanNames = (None,) * nObs

        self.canvas.setChanNames(chanNames, scale)

        colors = util.cycle(colors, nChan)

        if wxYield:
            wx.Yield()
        data = data.T
        lines = [wxplt.PolyLine(zip(t,d), legend=chan, colour=col, width=2)
            for d,col,chan in zip(data, colors, chanNames)]
        gc = wxplt.PlotGraphics(lines, title=self.title,
            xLabel=self.xLabel, yLabel=self.yLabel)

        if wxYield:
            wx.Yield()
        self.canvas.Draw(gc,
            xAxis=(np.min(t),np.max(t)),
            yAxis=(yMin,yMax))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号