在 Bokeh 中使用本地图像作为 Python 图形的标记
我想使用本地图像作为图形上的标记,而不是提供的形状。 像这样 图像源 因此,不要:
slider_renderer = plt.square(x='x_mercator', y='y_mercator', source=payload_at_timestamp, size=20, color='lightskyblue')
比如:
slider_renderer = plt.image(image='path/to/image', x='x_mercator', y='y_mercator', source=payload_at_timestamp, size=20, color='lightskyblue')
我尝试了几种方法来做到这一点,但没有成功。特别是,使用 Bokeh 图像对象 没有按预期工作,解释器抱怨图像不是源数据帧的一部分:
quad_icon = skimage.io.imread('analysis_icons/quad.png')
slider_renderer = Image(image=[quad_icon], x='x_mercator', y='y_mercator', source=payload_at_timestamp)
我当前正在 HTML 文件中输出结果图,因此使用 散景服务不是一个好的选择。
I want to use local images as the markers on a figure rather than the provided shapes.
Like this
image source So instead of:
slider_renderer = plt.square(x='x_mercator', y='y_mercator', source=payload_at_timestamp, size=20, color='lightskyblue')
Something like:
slider_renderer = plt.image(image='path/to/image', x='x_mercator', y='y_mercator', source=payload_at_timestamp, size=20, color='lightskyblue')
I've tried a few ways of doing this without success. In particular, using the Bokeh image object didn't work as intended, with the interpreter complaining that the image was not part of the source dataframe:
quad_icon = skimage.io.imread('analysis_icons/quad.png')
slider_renderer = Image(image=[quad_icon], x='x_mercator', y='y_mercator', source=payload_at_timestamp)
I'm currently outputting the resulting figure in an HTML file, so hosting it locally with bokeh serve isn't a good option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论