utilitiesClass.py 文件源码

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

项目:pslab-desktop-apps 作者: fossasia 项目源码 文件源码
def setColorSchemeBlack(self):
        """
        Changes plot background to black. Also changes plot colours
        """

        self.properties['colorScheme']='black'
        for plot in self.plots2D:
            try:
                plot.setBackground((0,0,0,255))
            except:
                pass
            for a in ['left','bottom','right']:
                try:
                    axis = plot.getAxis(a)
                    axis.setPen('w')
                except:
                    pass

            n=0
            if isinstance(plot, pg.widgets.PlotWidget.PlotWidget):  #Only consider curves part of the main left axis
                for c in self.plots2D[plot]: #Change curve colors to match black background
                    c.setPen(color=self.black_trace_colors[n], width=2)
                    n+=1
                    if(n==54):break

                try:
                    for d in self.plots2D[plot].viewBoxes:  #Go through the additional axes too
                        for f in self.plots2D[d]:
                            f.setPen(color=self.black_trace_colors[n], width=2)
                            n+=1
                            if(n==54):break
                except: pass

                try:
                    for d in plot.axisItems:  #Go through any additional axes, and set colors there too
                        d.setPen('w')
                except Exception as ex: print ('error while changing scheme',ex)




                for c in self.plots2D[plot]: #Change curve colors to match black background
                    c.setPen(color=self.black_trace_colors[n], width=3)
                    n+=1
                    if(n==54):break
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号