import pandas
from bokeh.plotting import figure, output_file, show
p=figure(plot_width=500,plot_height=400, tools='pan',logo=None)
p.title.text="Cool Data"
p.title.text_color="Gray"
p.title.text_font="times"
p.title.text_font_style="bold"
p.xaxis.minor_tick_line_color=None
p.yaxis.minor_tick_line_color=None
p.xaxis.axis_label="Date"
p.yaxis.axis_label="Intensity"
p.line([1,2,3],[4,5,6])
output_file("graph.html")
show(p)
错误:
Traceback (most recent call last):
File "basic_graph.py", line 4, in <module>
p=figure(plot_width=500,plot_height=400, tools='pan',logo=None)
File "C:\Users\Dhruva Jindal\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bokeh\plotting\figure.py", line 1364, in figure
return Figure(**kwargs)
File "C:\Users\Dhruva Jindal\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bokeh\plotting\figure.py", line 155, in __init__
super().__init__(*arg, **kw)
File "C:\Users\Dhruva Jindal\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bokeh\model.py", line 234, in __init__
super().__init__(**kwargs)
File "C:\Users\Dhruva Jindal\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bokeh\core\has_props.py", line 247, in __init__
setattr(self, name, value)
File "C:\Users\Dhruva Jindal\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bokeh\core\has_props.py", line 281, in __setattr__
raise AttributeError("unexpected attribute '%s' to %s, %s attributes are %s" %
AttributeError: unexpected attribute 'logo' to Figure, possible attributes are above, align, aspect_ratio, aspect_scale, background, background_fill_alpha, background_fill_color, below, border_fill_alpha, border_fill_color, center, css_classes, disabled, extra_x_ranges, extra_y_ranges, frame_height, frame_width, height,
height_policy, hidpi, inner_height, inner_width, js_event_callbacks, js_property_callbacks,
left, lod_factor, lod_interval, lod_threshold, lod_timeout, margin, match_aspect, max_height, max_width, min_border, min_border_bottom, min_border_left, min_border_right, min_border_top, min_height, min_width, name, outer_height,
outer_width, outline_line_alpha, outline_line_cap, outline_line_color, outline_line_dash, outline_line_dash_offset, outline_line_join, outline_line_width, output_backend, plot_height,
plot_width, renderers, reset_policy, right, sizing_mode, subscribed_events, tags, title, title_location, toolbar, toolbar_location, toolbar_sticky, visible, width, width_policy, x_range, x_scale, y_range or y_scale
代码:从bokeh导入熊猫。绘制导入图,输出文件,显示p = figure(plot_width = 500,plot_height = 400,tools ='pan',logo = None)p.title.text =“酷数据” p .title.text_color =“ Gray” p ....
logo=None
,请使用图形参数传入toolbar_location=None
。