bokeh.models.Band

Here are the examples of the python api bokeh.models.Band taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

3 View Source File : line.py
License : GNU Affero General Public License v3.0
Project Creator : andrewcooke

def add_band(f, x, ylo, yhi, source, color, alpha=0.3, y_range_name='default'):
    if f:
        band = Band(base=x, lower=ylo, upper=yhi, source=ColumnDataSource(source),
                    fill_color=color, fill_alpha=alpha, line_width=1, line_color=color,
                    y_range_name=y_range_name)
        f.add_layout(band)


def add_curve(f, x, y, source, group_size=30, color='black', alpha=1, smooth=1, y_range_name='default'):

0 View Source File : classes.py
License : GNU General Public License v3.0
Project Creator : lucasbellinaso

  def buildBokehFigs(self):
    from bokeh.models import ColumnDataSource,Span,Band,Label
    from bokeh.plotting import figure as BkFig
    #BOKEH FIGURES:
    #Vector data:
    self.bodesource = ColumnDataSource( data={'omega':[], 'freqHz': [],
              'magdBT':[],'magT':[],'magdBG':[],'magG': [],'angT':[],'angG':[]})
    self.gpbodesource = ColumnDataSource(data ={'fHz':[],'magdB':[],'angdeg':[]})
    self.gzbodesource = ColumnDataSource(data ={'fHz':[],'magdB':[],'angdeg':[]})
    self.cpbodesource = ColumnDataSource(data ={'fHz':[],'magdB':[],'angdeg':[]})
    self.czbodesource = ColumnDataSource(data ={'fHz':[],'magdB':[],'angdeg':[]})
    self.PM_GMsource = ColumnDataSource( data = {'PMfcHz': [1.,1.],'GMfHz':[2.,2.],
                                 'ylimsmag':[-200,200], 'ylimsang':[-720,720] })
    self.rlocussource = ColumnDataSource(data={'x':[],'y':[],'K':[]})
    self.gprlocussource = ColumnDataSource(data={'x':[],'y':[],'K':[]})
    self.gzrlocussource = ColumnDataSource(data={'x':[],'y':[],'K':[]})
    self.cprlocussource = ColumnDataSource(data={'x':[],'y':[],'K':[]})
    self.czrlocussource = ColumnDataSource(data={'x':[],'y':[],'K':[]})
    self.krlocussource = ColumnDataSource(data={'x':[],'y':[],'K':[]})
    self.stepsource = ColumnDataSource(data={'t_s':[],'stepRYmf':[],'stepUYma':[],'stepRUmf':[]})
    #self.tRespsource = ColumnDataSource(data={'t_s':[],'r':[],'du':[],'dy':[],'dm':[],'u':[],'y':[]})
    self.tRespsource = ColumnDataSource(data=self.CtrAnWgt.waveVec_dict)

    #Shadows:
    MAX_OVERSHOT = 0.01*self.CtrAnWgt.OShotIn.value + 1
    MAX_RISE_TIME, MAX_SETTLING_TIME = self.CtrAnWgt.RTimeIn.value, self.CtrAnWgt.STimeIn.value
    _thetaZ = np.linspace(0,np.pi,100)
    _costh, _sinthN, _sinth = np.cos(_thetaZ), -np.sin(_thetaZ), np.sin(_thetaZ)
    self.shadowsource = ColumnDataSource(
        data={'x_s': [0,1e4],     'ylow': [-1e4,1e4],  'yup': [1e4,1e4],  
            'xn_z': [-1e4,-1], 'xp_z': [1,1e4] , 'zero':[0,0],
            'overshot':[MAX_OVERSHOT, MAX_OVERSHOT], 
            'risetime':[MAX_RISE_TIME,1e4] , 'riselevel':[0.9,0.9],
            'settlingtime':[MAX_SETTLING_TIME,1e4],
            'setlevel1':[0.98,0.98], 'setlevel2':[1.02,1.02]  } )
    self.shadowZsource=ColumnDataSource(
               data = {'x_z':_costh, 'ylow_z':_sinthN, 'yup_z':_sinth, 
                       'ylow': 100*[-1e4], 'yup': 100*[1e4]})

    self.shadows = {
    'rloc_s': Band(base='x_s', lower='ylow', upper='yup', level='underlay',
            source=self.shadowsource, fill_color='lightgrey', line_color='black'),
    'rloc_z1': Band(base='xn_z', lower='ylow', upper='yup', level='underlay', 
            source=self.shadowsource, fill_color='lightgrey'),
    'rloc_z2': Band(base='xp_z', lower='ylow', upper='yup', level='underlay', 
            source=self.shadowsource, fill_color='lightgrey'),
    'rloc_z3': Band(base='x_z', lower='ylow', upper='ylow_z', level='underlay',
           source=self.shadowZsource,fill_color='lightgrey',line_color='black'),
    'rloc_z4': Band(base='x_z', lower='yup_z', upper='yup', level='underlay',
           source=self.shadowZsource,fill_color='lightgrey',line_color='black'),
    'ovsht': Band(base='x_s', lower='overshot', upper='yup', level='underlay',
            source=self.shadowsource,fill_color='lightgrey', visible=True),
    'riset': Band(base='risetime', lower='ylow', upper='riselevel', 
            level='underlay', source=self.shadowsource,fill_color='lightgrey'),
    'sett1': Band(base='settlingtime', lower='riselevel', upper='setlevel1', 
                 level='underlay', source=self.shadowsource,fill_color='lightgrey'),
    'sett2': Band(base='settlingtime', lower='setlevel2', upper='overshot', 
                 level='underlay', source=self.shadowsource,fill_color='lightgrey') }                    

    _TTS_BD1 = [('sys',"$name"),("f","$x Hz"),("mag","$y dB")]
    _TTS_BD2 = [('sys',"$name"),("f","$x Hz"),("ang","$y°")]
    _TTS_RLOC= [("real","@x"),("imag","@y"),('K','@K{0.00 a}')]
    _TTS_TRESP = [('signal', "$name"), ("t", "$x s"), ("value", "$y") ]
    self.figMag = BkFig(title="Bode Magnitude", plot_height=300, plot_width=400,
               toolbar_location="above", tooltips = _TTS_BD1, x_axis_type="log",
               x_axis_label='f (Hz)', y_axis_label='mag (dB)')
    self.figAng =  BkFig(title="Bode Angle", plot_height=300, plot_width=400,
                toolbar_location="above", tooltips = _TTS_BD2, x_axis_type="log",
                x_axis_label='f (Hz)', y_axis_label='ang (°)')
    self.figAng.x_range  = self.figMag.x_range   #same axis
    self.figAng.yaxis.ticker=np.linspace(-720,720,17)
    self.figRLoc=  BkFig(title="Root Locus", plot_height=300, plot_width=400,
                toolbar_location="above", tooltips = _TTS_RLOC,
                x_axis_label='real', y_axis_label='imag')
    #self.figRLoc.hover.line_policy = 'interp'
    self.figTResp = BkFig(title="Step Response", plot_height=300, plot_width=400,
                toolbar_location="above", tooltips = _TTS_TRESP,
                x_axis_label='time (s)', y_axis_label='y') 
    self.figTResp2= BkFig(title="Disturbance Simulation", plot_height=300, plot_width=800, 
                toolbar_location="above", tooltips = _TTS_TRESP,
                x_axis_label='time (s)', y_axis_label='y, r, dy, dm')
 
    self.Bkgrid = bokeh.layouts.layout([[self.figMag, self.figRLoc],
                                        [self.figAng, self.figTResp],
                                        self.figTResp2])


    if self.dt in [None, 0.0]:   #continuous time
      self.figRLoc.add_layout(self.shadows['rloc_s'])
    else:                 #discrete time
        for strkey in ['rloc_z1', 'rloc_z2', 'rloc_z3', 'rloc_z4']:
          self.figRLoc.add_layout(self.shadows[strkey])
        self.Nyquistlimits = Span(location=0.5/self.dt,
                                 dimension='height', line_color='black',
                                 line_dash='dotted', line_width=1)
        self.figMag.add_layout(self.Nyquistlimits)
        self.figAng.add_layout(self.Nyquistlimits)
    for strkey in ['ovsht', 'riset', 'sett1', 'sett2']:
      self.figTResp.add_layout(self.shadows[strkey])
      #self.figTResp2.add_layout(self.shadows[strkey])


    #Bode Diagram:
    bodemagT=self.figMag.line(x='freqHz', y='magdBT',color="blue",line_width=1.5,
                alpha=0.8,name='|T(s)|',legend_label='T(s)',source=self.bodesource)
    bodemagG=self.figMag.line(x='freqHz', y='magdBG',color="green",line_width=1.5, 
                alpha=0.8,name='|Gp(s)|',line_dash='dashed',
                legend_label='Gp(s)',source=self.bodesource)
    bodeangT=self.figAng.line(x='freqHz', y='angT', color="blue", line_width=1.5,
                alpha=0.8, name='∡T(s)', source=self.bodesource)
    bodeangG=self.figAng.line(x='freqHz', y='angG',color="green", line_width=1.5,
                alpha=0.8,name='∡Gp(s)',line_dash='dashed',source=self.bodesource)
    bodeGpmag = self.figMag.x( x='fHz',y='magdB',line_color='blue', size=10,
                 name='Gp poles', source = self.gpbodesource)
    bodeGpang=self.figAng.x(x='fHz',y='angdeg',line_color='blue', size=10,
                 name='Gp poles angle', source = self.gpbodesource)
    bodeGzmag = self.figMag.circle(x='fHz',y='magdB',line_color='blue',size=8,
                 name='Gp zeros',fill_color=None, source = self.gzbodesource)
    bodeGzang=self.figAng.circle(x='fHz',y='angdeg',line_color='blue',size=8,
              name='Gp zeros angle', fill_color=None,source = self.gzbodesource)
    bodeCpmag = self.figMag.x(x='fHz',y='magdB',line_color='red',size=10,
                 name='C poles', source = self.cpbodesource)
    bodeCpang=self.figAng.x(x='fHz',y='angdeg',line_color='red',size=10,
                 name='C poles angle', source = self.cpbodesource)
    bodeCzmag = self.figMag.circle(x='fHz',y='magdB',line_color='red',size=8,
                 name='C zeros', fill_color=None, source = self.czbodesource)
    bodeCzang=self.figAng.circle(x='fHz',y='angdeg',line_color='red',size=8,
                name='C zeros angle',fill_color=None, source = self.czbodesource)
    self.GMSpan = Span(location=1, dimension='height',
                       line_color='black', line_dash='dotted', line_width=1)
    self.PMSpan = Span(location=1, dimension='height',
                       line_color='black', line_dash='dotted', line_width=1)
    self.PMtxt = Label(x=5, y=5, x_units='screen', y_units='screen', 
                         text=' ',  render_mode='css',border_line_color=None,
                        background_fill_color='white',text_font_size = '11px')
    self.GMtxt = Label(x=5, y=20, x_units='screen', y_units='screen', 
                         text=' ',  render_mode='css',border_line_color=None,
                        background_fill_color='white',text_font_size = '11px')
    #self.Clbltxt = Label(x=5, y=20, x_units='screen', y_units='screen', 
    #                     text=' ',  render_mode='css',border_line_color=None,
    #                    background_fill_color='white',text_font_size = '11px')
    #self.Clbltxt.text = 'C(s) = ' if self.dt in [None, 0.0] else 'C(z) = '
    #self.Cgaintxt = Label(x=40, y=20, x_units='screen', y_units='screen', 
    #                     text='K',  render_mode='css',border_line_color=None,
    #                    background_fill_color='white',text_font_size = '11px')
    #self.Cnumtxt = Label(x=100, y=30, x_units='screen', y_units='screen', 
    #                     text='N',  render_mode='css',border_line_color=None,
    #                    background_fill_color='white',text_font_size = '11px')
    #self.Cdentxt = Label(x=100, y=10, x_units='screen', y_units='screen', 
    #                     text='D',  render_mode='css',border_line_color=None,
    #                    background_fill_color='white',text_font_size = '11px')
    self.figMag.add_layout(self.GMSpan), self.figAng.add_layout(self.GMSpan)
    self.figMag.add_layout(self.PMSpan), self.figAng.add_layout(self.PMSpan)
    self.figAng.add_layout(self.PMtxt), self.figAng.add_layout(self.GMtxt)
    #self.figMag.add_layout(self.Clbltxt), self.figMag.add_layout(self.Cgaintxt)
    #self.figMag.add_layout(self.Cnumtxt), self.figMag.add_layout(self.Cdentxt)

    #Root Locus:
    rlocusline = self.figRLoc.dot(x='x',y='y',color='blue',
                                  name='rlocus', source = self.rlocussource)
    rlocusGpoles = self.figRLoc.x(x='x',y='y',color='blue', size=10,
                                name='Gp pole', source = self.gprlocussource)
    rlocusGzeros = self.figRLoc.circle(x='x',y='y',line_color='blue',size=8,
                 name='Gp zero', fill_color=None, source = self.gzrlocussource)
    rlocusCpoles = self.figRLoc.x(x='x',y='y',color='red', size=10,
                                name='C pole', source = self.cprlocussource)
    rlocusCzeros = self.figRLoc.circle(x='x',y='y',line_color='red',size=8,
                 name='C zero', fill_color=None, source = self.czrlocussource)
    rlocusMF = self.figRLoc.square(x='x',y='y', line_color='deeppink',size=8,
                 name='K', fill_color='deeppink', source = self.krlocussource)
    rlocuslinehv = self.figRLoc.line(x='x',y='y',line_alpha=0, 
                                  name='rlocus2', source = self.rlocussource)
    self.figRLoc.hover.renderers=[rlocuslinehv, rlocusGpoles, rlocusGzeros,
                                  rlocusCpoles, rlocusCzeros, rlocusMF]
    #self.figRLoc.hover.mode='mouse'   
    #self.figRLoc.hover.line_policy='next'
    #self.figRLoc.hover.point_policy='snap_to_data'
    self.Stabilitytxt = Label(x=10, y=200, x_units='screen', y_units='screen', 
                         text=' ',  render_mode='css',border_line_color=None,
                        background_fill_color='white',text_font_size = '11px')
    self.figRLoc.add_layout(self.Stabilitytxt)

    #Step response:
    self.figTResp.extra_y_ranges = {'u_range': bokeh.models.Range1d()}
    self.figTResp.add_layout(bokeh.models.LinearAxis(y_range_name="u_range",
                                                     axis_label='u'), 'right')
    self.figTResp.y_range = bokeh.models.Range1d(start = -0.1, end = 1.4)
    #add_graf = self.figTResp.line if self.dt in [None, 0.0] else self.figTResp.dot
    if self.dt in [None, 0.0]:
        stepR2Y=self.figTResp.line(x='t_s', y='stepRYmf',color="blue",line_width=1.5, name='y',
                        legend_label='y (closed loop)',  source=self.stepsource)
        stepU2Y=self.figTResp.line(x='t_s', y='stepUYma',color="green",
               legend_label='y (open loop)', line_dash='dashed', line_width=1.0,
                                name='y (ol)',source=self.stepsource, visible=False)
        stepR2U=self.figTResp.line(x='t_s', y='stepRUmf',color="red",
                       line_width=1.0, name='u',legend_label='u (closed loop)',
            line_dash='dashed', source=self.stepsource, y_range_name = 'u_range', visible=False)
    else:
        stepR2Y=self.figTResp.dot(x='t_s', y='stepRYmf',color="blue",
                                 line_width=1.5, name='y',  size=15,
                        legend_label='y (closed loop)',  source=self.stepsource)
        stepU2Y=self.figTResp.dot(x='t_s', y='stepUYma',color="green", size=15,
                                legend_label='y (open loop)', line_width=1.0,
                                name='y (ol)',source=self.stepsource, visible=False)
        stepR2U=self.figTResp.dot(x='t_s', y='stepRUmf',color="red", size=15,
                       line_width=1.0, name='u',legend_label='u (closed loop)',
                       source=self.stepsource, y_range_name = 'u_range', visible=False)
    self.figTResp.legend.location = 'bottom_right'
    self.figTResp.legend.click_policy = 'hide'

    #Disturbances response:
    self.figTResp2.extra_y_ranges = {'u_range': bokeh.models.Range1d()}
    self.figTResp2.add_layout(bokeh.models.LinearAxis(y_range_name="u_range",
                                                     axis_label='u, du'), 'right')
    self.figTResp2.y_range = bokeh.models.Range1d(start = -0.1, end = 1.4)
    if self.dt in [None, 0.0]:
        tRespY=self.figTResp2.line(x='t_s', y='y',color="blue", line_width=1.5, name='y',
                        legend_label='y',  source=self.tRespsource)
        tRespU=self.figTResp2.line(x='t_s', y='u',color="red", legend_label='u', line_width=1.5,
                      name='u',source=self.tRespsource, y_range_name = 'u_range', visible=False)
        tRespDU=self.figTResp2.line(x='t_s', y='du',color="indianred", line_width=1.0, name='du',legend_label='du',
                                    line_dash='dashed', source=self.tRespsource, y_range_name = 'u_range', visible=False)
        tRespR=self.figTResp2.line(x='t_s', y='r',color="green", line_width=1.0, name='r',legend_label='r',
                                  line_dash='dashed', source=self.tRespsource)
        tRespDY=self.figTResp2.line(x='t_s', y='dy',color="deepskyblue", line_width=1.0, name='dy',legend_label='dy',
                                    line_dash='dashed', source=self.tRespsource, visible=False)
        tRespDM=self.figTResp2.line(x='t_s', y='dm',color="lime", line_width=1.0, name='dm',legend_label='dm',
                                    line_dash='dashed', source=self.tRespsource, visible=False)
    else:
        tRespY=self.figTResp2.dot(x='t_s', y='y',color="blue", line_width=1.5, size=15, name='y',
                        legend_label='y',  source=self.tRespsource)
        tRespU=self.figTResp2.dot(x='t_s', y='u',color="red", legend_label='u', line_width=1.5, size=15,
                      name='u',source=self.tRespsource, y_range_name = 'u_range', visible=False)
        tRespDU=self.figTResp2.dot(x='t_s', y='du',color="indianred", line_width=1.0, name='du',legend_label='du',
                              size=15, line_dash='dashed', source=self.tRespsource, y_range_name = 'u_range', visible=False)
        tRespR=self.figTResp2.dot(x='t_s', y='r',color="green", line_width=1.0, name='r',legend_label='r',size=15,
                                  line_dash='dashed', source=self.tRespsource)
        tRespDY=self.figTResp2.dot(x='t_s', y='dy',color="deepskyblue", line_width=1.0, name='dy',legend_label='dy',
                                size=15,line_dash='dashed', source=self.tRespsource, visible=False)
        tRespDM=self.figTResp2.dot(x='t_s', y='dm',color="lime", line_width=1.0, name='dm',legend_label='dm',
                               size=15, line_dash='dashed', source=self.tRespsource, visible=False)
    self.figTResp2.legend.location = 'bottom_right'
    self.figTResp2.legend.click_policy = 'hide'

  def updateTFAndBokeh(self,b):

0 View Source File : visualization.py
License : MIT License
Project Creator : pedromartins4

def plot_stock_price(stock):
    p = figure(x_axis_type="datetime", plot_width=WIDTH_PLOT, plot_height=400,
               title="Stock price + Bollinger Bands (2 std)",
               tools=TOOLS, toolbar_location='above')

    inc = stock.data['close'] > stock.data['open']
    dec = stock.data['open'] > stock.data['close']
    view_inc = CDSView(source=stock, filters=[BooleanFilter(inc)])
    view_dec = CDSView(source=stock, filters=[BooleanFilter(dec)])

    width = 35000000

    p.segment(x0='date', x1='date', y0='low', y1='high', color=RED, source=stock, view=view_inc)
    p.segment(x0='date', x1='date', y0='low', y1='high', color=GREEN, source=stock, view=view_dec)

    p.vbar(x='date', width=width, top='open', bottom='close', fill_color=RED, line_color=RED,
           source=stock,
           view=view_inc)
    p.vbar(x='date', width=width, top='open', bottom='close', fill_color=GREEN, line_color=GREEN,
           source=stock,
           view=view_dec)

    # p.line(x='date', y='close_line', line_width=1, color=BLUE, line_alpha=0.7, souce=stock)

    band = Band(base='date', lower='bolling_lower', upper='bolling_upper', source=stock, level='underlay',
                fill_alpha=0.5, line_width=1, line_color='black', fill_color=BLUE_LIGHT)
    p.add_layout(band)

    code = """
    def ticker():
        return "{:.0f} + {:.2f}".format(tick, tick % 1)
    """
    p.yaxis.formatter = NumeralTickFormatter(format='$ 0,0[.]000')

    return p


# Simple Moving Average
def plot_sma(stock):

0 View Source File : widgets.py
License : MIT License
Project Creator : smartyal

    def __plot_lines(self,newVars = None,appendingDataArrived=False,forceYRescale=False,allowXAxisReset = True):
        """ plot the currently selected variables as lines, update the legend
            if newVars are given, we only plot them and leave the old
        """
        self.logger.debug("@__plot_lines")

        if newVars == None:
            #take them all fresh
            newVars = self.server.get_variables_selected()

        #first, get fresh data
        settings= self.server.get_settings()
        variables = self.server.get_variables_selected()
        mirr = self.server.get_mirror()
        if "autoScaleY" in mirr:
            self.autoAdjustY = mirr["autoScaleY"][".properties"]["value"]

        if "resetXAxisAfterBlankCanvas" in mirr:
            canResetXAxis = mirr["resetXAxisAfterBlankCanvas"][".properties"]["value"]
        else:
            canResetXAxis = False #as default we dont reset

        showMarker = False
        if "showMarker" in mirr:
            showMarker = mirr["showMarker"][".properties"]["value"]
        #self.logger.debug("@__plot_lines:from server var selected %s",str(newVars))
        variablesRequest = variables.copy()
        variablesRequest.append("__time")   #make sure we get the time included
        #self.logger.debug("@__plot_lines:self.variables, bins "+str(variablesRequest)+str( settings["bins"]))
        if self.streamingMode and appendingDataArrived:
            getData = self.server.get_data(variablesRequest, -self.streamingInterval, None,self.server.get_settings()["bins"])
        else:
            if not self.lines and canResetXAxis and allowXAxisReset:
                # if we don't have lines yet, we get the full time range of the "new" variable
                start,end = None,None
            else:
                start,end = self.rangeStart,self.rangeEnd
            getData = self.server.get_data(variablesRequest,start,end,settings["bins"]) # for debug

        #self.logger.debug("GETDATA:"+str(getData))
        if not getData:
            self.logger.error(f"no data received")
            return
        if self.rangeStart == None or self.streamingMode:
            mini,maxi = self.get_min_max_times(getData)
            if maxi==mini:
                maxi = mini+1
                mini = mini-1
            minY,maxY = self.get_min_max_y(getData)
            if minY == maxY:
                maxY = minY+1
                minY = minY-1
            #write it back
            self.rangeStart = mini#getData["__time"][0]
            self.rangeEnd   = maxi#getData["__time"][-1]
            self.server.set_xy_range(self.rangeStart, self.rangeEnd,minY,maxY)

        #del getData["__time"]
        #getData["__time"]=[0]*settings["bins"] # dummy for the hover


        """
        if newVars == []:
            #self.data.data = getData  # also apply the data to magically update
            for k,v in getData.items():
                if not k.endswith("__time"):
                    self.columnData[k].data ={"y":v,"x":getData[k+"__time"]}
        else:
            self.logger.debug("new column data source")
            if self.data is None:
                #first time
                self.data = ColumnDataSource(getData)  # this will magically update the plot, we replace all data
                #also new store
                self.columnData  = {}
                for k,v in getData.items():
                    if not k.endswith("__time"):
                        self.columnData[k]=ColumnDataSource({"y":v,"x":getData[k+"__time"]})

            else:
                #add more data
                for variable in getData:
                    if variable not in self.columnData:#data.data:
                        self.columnData[variable]=ColumnDataSource({"y":v,"x":getData[k+"__time"]})
                        #self.data.add(getData[variable],name=variable)
        """
        self.update_column_datas(getData)

        #self.logger.debug(f"self.columnData {self.columnData}")
        self.adjust_y_axis_limits(force=forceYRescale)
        #timeNode = "__time"
        #now plot var

        if newVars != []:
            #sort the limits to the end so that the lines are created first, then the band can take the same color
            newList = []
            newMaxes = []
            for elem in newVars:
                if elem.endswith("_limitMax") or elem.endswith("_limitMin") or elem.endswith("_expected"):
                    newMaxes.append(elem)
                else:
                    newList.append(elem)
            newVars = newList+newMaxes

        if newVars and not self.lines and canResetXAxis and allowXAxisReset:
            #this is the first lines after a blank canvas
            #set this again for the reset at the end
            resetXAxis=True
        else:
            resetXAxis=False

        for variableName in newVars:
            if variableName.endswith('__time'):
                continue
            color = self.__get_free_color(variableName)
            self.logger.debug("new color ist"+color)

            self.logger.debug(f"plotting line {variableName}, is score: {self.server.is_score_variable(variableName)}")
            if self.server.is_score_variable(variableName):
                scoreMarker = self.server.get_score_marker(variableName)
                #this is a red circle score varialbe
                if not self.server.is_y2_variable(variableName):
                    if scoreMarker == "x":
                        self.lines[variableName] = self.plot.asterisk(x="x", y="y", line_color="red", fill_color=None,
                                                                source=self.columnData[variableName], name=variableName,size=10)  # x:"time", y:variableName #the legend must havee different name than the source bug
                    elif scoreMarker=="+":
                        self.lines[variableName] = self.plot.cross(x="x", y="y", line_color="red", fill_color=None,
                                                                source=self.columnData[variableName], name=variableName,size=10)
                    else:
                        #default is circle
                        self.lines[variableName] = self.plot.circle(x="x", y="y", line_color="red", fill_color=None,
                                                                source=self.columnData[variableName], name=variableName,
                                                                size=7)  # x:"time", y:variableName #the legend must havee different name than the source bug
                else:
                    #is a y2 score
                    if self.server.has_y2():
                        if scoreMarker == "x":
                            self.lines[variableName] = self.plot.asterisk(x="x", y="y", line_color="red", fill_color=None,
                                                                        source=self.columnData[variableName],
                                                                        name=variableName,
                                                                        size=10, y_range_name="y2")  # x:"time", y:variableName #the legend must havee different name than the source bug
                        elif scoreMarker == "+":
                            self.lines[variableName] = self.plot.cross(x="x", y="y", line_color="red", fill_color=None,
                                                                    source=self.columnData[variableName],
                                                                    name=variableName, size=10, y_range_name="y2")
                        else:
                            # default is circle
                            self.lines[variableName] = self.plot.circle(x="x", y="y", line_color="red", fill_color=None,
                                                                        source=self.columnData[variableName],
                                                                        name=variableName,
                                                                        size=7, y_range_name="y2")  # x:"time", y:variableName #the legend must havee different name than the source bug


            elif variableName.endswith("_limitMax"):
                if variableName in self.columnData:# if it is in the column data we can process
                    #we found both min and max
                    thisLineColor = None
                    originalVarName = variableName.split('.')[-1][:-len("_expected")]
                    for lineName in self.lines:
                        if lineName.split('.')[-1] == originalVarName:
                            thisLineColor = self.lines[lineName].glyph.line_color
                            break
                    if not thisLineColor:
                        thisLineColor = "gray"
                    band = None 
                    if self.server.is_y2_variable(variableName):
                        if self.server.has_y2():#only create this if we have a y2, otherwise bokeh gets problems with log axis
                            band = Band(base='x', lower='lower', upper='upper', level=globalBandsLevel,fill_color = thisLineColor,
                                        fill_alpha=0.4, line_width=0,source = self.columnData[variableName],name=variableName,y_range_name="y2")
                    else:
                        band = Band(base='x', lower='lower', upper='upper', level=globalBandsLevel,
                                    fill_color=thisLineColor,
                                    fill_alpha=0.4, line_width=0, source=self.columnData[variableName],
                                    name=variableName)
                    if band:
                        self.lines[variableName] = band
                        self.plot.add_layout(band)
                continue
            elif variableName.endswith("_limitMin"):
                continue


            else:
                #these are the lines

                """ 
                if ".score" in variableName:
                    # this is a score 0..1 line
                    self.lines[variableName] = self.plot.line(x="x", y="y", color="gray", line_dash="dotted",
                                                              source=self.columnData[variableName], name=variableName, line_width=2,
                                                              y_range_name="y2")  # x:
                """
                if 1:

                    if variableName.endswith("_expected"):
                        # this is a special case of a line which we display dotted in the same color as the original one
                        # try to find the corresponding variable
                        thisLineColor = None
                        originalVarName = variableName.split('.')[-1][:-len("_expected")]
                        for lineName in self.lines:
                            if lineName.split('.')[-1] == originalVarName:
                                thisLineColor = self.lines[lineName].glyph.line_color
                                break
                        if not thisLineColor:
                            thisLineColor = color
                        if self.server.is_y2_variable(variableName):
                            if self.server.has_y2():
                                self.lines[variableName] = self.plot.line(x="x", y="y", color=thisLineColor,
                                                                  source=self.columnData[variableName], name=variableName,
                                                                  line_width=4, line_dash="dashed",y_range_name="y2")
                        else:
                            self.lines[variableName] = self.plot.line(x="x", y="y", color=thisLineColor,
                                                                      source=self.columnData[variableName],
                                                                      name=variableName,
                                                                      line_width=4, line_dash="dashed")
                    else:

                        #this is a real line
                        #self.debugStore =copy.deepcopy(getData)
                        #self.lines[variableName] = self.plot.line(x=variableName+"__time", y=variableName, color=color,
                        #                              source=self.data, name=variableName,line_width=2)  # x:"time", y:variableName #the legend must havee different name than the source bug
                        if self.server.is_y2_variable(variableName):
                            if self.server.has_y2():
                                self.lines[variableName] = self.plot.line(x="x", y="y", color=color,
                                                                      source=self.columnData[variableName],
                                                                      name=variableName, line_width=4,
                                                                      y_range_name="y2")
                        else:
                            self.lines[variableName] = self.plot.line(x="x", y="y", color=color,
                                                                      source=self.columnData[variableName],
                                                                      name=variableName,line_width=2)

                        if showMarker:
                            markerName = variableName+"_marker"
                            if self.server.is_y2_variable(variableName):
                                if self.server.has_y2():
                                    marker = self.plot.circle(x="x", y="y", line_color=color, fill_color=color,
                                                          source=self.columnData[variableName], name=markerName,
                                                          size=7,y_range_name="y2")  # x:"time", y:variableName #the legend must havee different name than the source bug

                            else:
                                marker = self.plot.circle(x="x",y="y", line_color=color, fill_color=color,
                                                      source=self.columnData[variableName], name=markerName,size=3)  # x:"time", y:variableName #the legend must havee different name than the source bug
                #legend only for lines
                self.legendItems[variableName] = LegendItem(label='.'.join(variableName.split('.')[-2:]),
                                                            renderers=[self.lines[variableName]])

            #we set the lines and glypsh to no change their behaviour when selections are done, unfortunately, this doesn't work, instead we now explicitly unselect in the columndatasource
            self.lines[variableName].nonselection_glyph = None  # autofading of not selected lines/glyphs is suppressed
            self.lines[variableName].selection_glyph = None     # self.data.selected = Selection(indices = [])

            #self.legendItems[variableName] = LegendItem(label=variableName,renderers=[self.lines[variableName]])

            if self.showThresholds:
                self.show_thresholds_of_line(variableName)
            if self.showMotifs:
                self.show_motifs_of_line(variableName)

        #compile the new colors
        nowColors = {}
        for variableName,glyph in self.lines.items():
            if variableName.endswith("_limitMax"):
                nowColors[variableName] = {"lineColor": glyph.line_color}
            else:
                nowColors[variableName] = {"lineColor":glyph.glyph.line_color}
        self.server.update_current_colors(nowColors)




        #now make a legend
        #legendItems=[LegendItem(label=var,renderers=[self.lines[var]]) for var in self.lines]
        legendItems = [v for k,v in self.legendItems.items()]
        if not self.hasLegend:
            #at the first time, we create the "Legend" object
            self.plot.add_layout(Legend(items=legendItems))
            self.plot.legend.location = "top_left"
            self.plot.legend.click_policy = "hide"
            self.hasLegend = True
            #check if we need to hide it on start
            mirr = self.server.get_mirror()
            if "showLegend" in mirr:
                if mirr["showLegend"][".properties"]["value"] == False:
                    self.plot.legend.visible=False
        else:
            self.plot.legend.items = legendItems #replace them

        if resetXAxis:
            #        #we must explicitly disable this functionality, else we default reset the axis
            #        #as it is not wanted in all cases, e.g. when we remove a var and add a var, we want to keep the zoom, or bunch plots etc
          self.reset_x_axis() 
        
        self.set_x_axis()
        self.server.set_y_range(self.plot.y_range.start,self.plot.y_range.end)
        #self.adjust_y_axis_limits()

        return getData # so that later executed function don't need to get the data again

    def range_cb(self, attribute,old, new):