我可以在帖子中生成和嵌入bokeh图,但是无法得到图的左对齐(或中间)。
使用autoload_static()
生成的图如下所示:
import numpy as np
from bokeh.plotting import figure
from bokeh.embed import autoload_static
from bokeh.resources import CDN
x = np.random.uniform(0, 1, 10)
y = np.random.uniform(0, 1, 10)
p = figure(width = 400, height = 400,
title = 'Sample Figure')
p.circle(x, y, size = 10)
js, tag = autoload_static(model = p, resources = CDN,
script_path = 'mysite/sample.js')
jsfile = open('sample.js', 'w')
jsfile.write(js)
jsfile.close
print(tag)
然后,将sample.js
上传到站点,并将标签粘贴到wordpress的post编辑器中,我将看到以下内容:
怎样才能使图形的左边边缘与柱子的左边边缘对齐?
编辑:刚刚看到了这个问题
中心嵌入式Bokeh地块,我认为这是同样的问题,但我有点过头了。
发布于 2016-12-07 03:23:42
我自己也不太确定,但我有几个想法你可以研究一下,
1)退房:https://github.com/bokeh/bokeh/tree/master/examples/embed
2)我知道在wordpress上用HTML写文章是可能的,如果您将js内容与脚本标记放在一起,据我所知,它应该嵌入代码。
希望这能有所帮助。
https://stackoverflow.com/questions/37285914
复制相似问题