Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Bokeh(Python)中插入RGBA图片?_Python_Matplotlib_Bokeh - Fatal编程技术网

在Bokeh(Python)中插入RGBA图片?

在Bokeh(Python)中插入RGBA图片?,python,matplotlib,bokeh,Python,Matplotlib,Bokeh,我想插入一张图片作为博克情节的背景。我使用image\u RGBA和image\u url解决方案将1280*800 png文件转换为RGBA数组,但渲染需要几分钟时间,.html输出会导致浏览器崩溃 这是我的密码: import matplotlib.image as mpimg from bokeh.plotting import figure, show, output_file output_file('output.html') img = mpimg.imread('image.p

我想插入一张图片作为博克情节的背景。我使用
image\u RGBA
image\u url
解决方案将1280*800 png文件转换为RGBA数组,但渲染需要几分钟时间,.html输出会导致浏览器崩溃

这是我的密码:

import matplotlib.image as mpimg
from bokeh.plotting import figure, show, output_file
output_file('output.html')

img = mpimg.imread('image.png')
p = figure()
p.image_rgba(image=[img], x=[0], y=[799])
show(p)

这是一个bug还是我在这里遗漏了什么?

您可能希望尝试从scipy.misc import imread
而不是使用matplotlib
mpimg
。您可能希望尝试从scipy.misc import imread
而不是使用matplotlib
mpimg