我正在尝试将水印添加到bokeh现有的分类图表中。我试图通过多种方法添加图像,但还没能使其工作。在
我尝试过使用category(字符串)作为x位置值。这将导致WebDriverException:
{"errorMessage":"undefined is not an object (evaluating 'document.getElementsByClassName('bk-root')[0].children[0].getBoundingClientRect')","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Content-Length":"171","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:52857","User-Agent":"selenium/3.141.0 (python windows)"},"httpVersion":"1.1","method":"POST","post":"{\"script\": \"\nreturn document.getElementsByClassName('bk-root')[0].children[0].getBoundingClientRect()\n\", \"args\": [], \"sessionId\": \"308a7240-6123-11e9-a877-6d9cf99e3c61\"}","url":"/execute","urlParsed":{"anchor":"","query":"","file":"execute","directory":"/","path":"/execute","relative":"/execute","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute","queryKey":{},"chunks":["execute"]},"urlOriginal":"/session/308a7240-6123-11e9-a877-6d9cf99e3c61/execute"}}
我还尝试过将类别作为列表中的位置传递(category[5])。这不会出错,但不会在绘图上放置图像。在
# Add watermark
p.image_url(url=[r'static/images/image.png'], x='Mismatch', y=500, w=100, h=100,
anchor = 'center',
global_alpha = 0.2)
预期的结果是图像将出现在我的分类图上所需的位置。在
实际的结果是没有图像出现,或者发生webdriverexception。在
谢谢你的帮助!在
您可以在
Div
中使用此解决方案。您可以在Div
中放置任意的HTML代码,并使用内联css样式表(bokehv1.1.0)将这个Div
放在屏幕上的任何位置。在结果:
相关问题 更多 >
编程相关推荐