I can generate and embed a bokeh plot in a post, but can't get the plot to align left (or center)
Plot generated using autoload_static() as shown here:
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)
Then, uploading sample.js to the site, and pasting the tag into the wordpress post editor gives me this:
embedded figure
How can I get the left edge of the figure to align with the left edge of the post?
Edit: Just saw this question
Center embedded Bokeh plot, which I think is the same issue, but it's a bit over my head.
I am not entirely certain myself but I have a couple ideas you can look into,
1) Check out: https://github.com/bokeh/bokeh/tree/master/examples/embed
2) I know it is possible to write posts in HTML on wordpress if you put the js content with script tags, from what I understand, it should embed the code.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With