Python 3.x 博克:有没有一种方法可以同时设置所有人物的造型?

Python 3.x 博克:有没有一种方法可以同时设置所有人物的造型?,python-3.x,pandas,bokeh,Python 3.x,Pandas,Bokeh,我正在为20多个选项卡编写代码,以绘制类似的参数,并分别为每个图形编写样式。有没有一种方法可以同时设置所有图形的样式 p = figure(tools=TOOLS, x_axis_type='datetime',plot_height=400, plot_width=700, outline_line_color = 'gray', y_axis_label = 'Volts', y_range = DataRange1d()

我正在为20多个选项卡编写代码,以绘制类似的参数,并分别为每个图形编写样式。有没有一种方法可以同时设置所有图形的样式

p = figure(tools=TOOLS, x_axis_type='datetime',plot_height=400, plot_width=700,
           outline_line_color = 'gray',
           y_axis_label = 'Volts',
          y_range = DataRange1d()
          )
# Setting the second y axis range name and range
#p.extra_y_ranges = {"foo": Range1d(start=0, end=0.000006)}
p.extra_y_ranges = {"foo": DataRange1d()}

# Adding the second axis to the plot.  
p.add_layout(LinearAxis(y_range_name="foo"), 'right')

a1=p.line(x='Time', y='340', line_color="darkcyan", line_width=1, source=source)
a11 = p.line(x='Time',y='StdDev', line_color = 'red', line_width=1, y_range_name="foo", source=source)
p.y_range.renderers=[a1]
p.extra_y_ranges['foo'].renderers = [a11]

tooltips=[( "Time", "@Time{%H:%M:%S}"),
        ("Y-value", "$y")]
formatt ={'Time':'datetime'}
p.add_tools(HoverTool(tooltips=tooltips, formatters=formatt, mode = 'mouse'))
p.title.text = "Plot Title "
p.title.text_color = "gray"
p.title.text_font = "arial"
p.title.text_font_style = "bold"
p.xgrid[0].grid_line_color=None
p.ygrid[0].grid_line_alpha=0.5
p.xaxis.axis_label = 'TimeStamp'

按照我的方法,我基本上需要为每个选项卡重复上述代码20多次。

只需将其包装成一个返回
p
的函数即可?对不起……我不知道为什么我会想到除此之外的所有事情!!非常感谢。不客气,我去过那里!或者你可以用一个