python - Ttle 和颜色属性不适用于此散景图
问题描述
编码:
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
以上是我正在运行的代码请让我知道这段代码的问题所在。我还粘贴了我在运行此代码时很热的错误代码,以便您知道究竟是什么问题。
解决方案
如果您希望工具栏完全隐藏,而不是,请使用您的 Figure argslogo=None
传入。toolbar_location=None
如果你想要工具栏,只是没有标志,在你的 Figure 被声明后添加这一行:
p.toolbar.logo = None
推荐阅读
- android - 如何在 Spinner 中获取值并将值传递给 url 进行翻译
- python - Plotly:如何从嵌套字典中检索分组条形图的 y 轴值?
- google-cloud-platform - 谷歌云平台上的FusionPBX安装
- css - 如何在没有完整层次结构的情况下直接调用 CSS 类?
- php - 如何获取所有 WooCommerce 产品属性分类法和名称
- javascript - ReactJs:如何预加载资产和组件,以便在与互联网断开连接时显示它们
- javascript - 满足条件后运行其余代码
- google-app-engine - 为什么在 Google App Engine 上构建项目时出现 MemoryError
- sql - 如何获取与另一组属性关联的一组属性?
- java - 用矩阵分割树