他の回答に基づいて、ここに便利になることがあり抜粋です。
import os
import re
import tempfile
import webbrowser
import time
from bokeh.io import output_file, save
def save_bokeh_nomargins(plot, filename):
"""
Saves a bokeh plot/layout without having the left margin.
"""
# Strategy:
# 1. save the plot to a temp file
# 2. change the offending line of code
# 3. save the result to the destination file
ftemp = tempfile.mktemp()
try:
output_file(ftemp)
save(plot)
with open(ftemp) as ftemph, open(filename, "w") as fouth:
fouth.write(re.sub("width: 90%;", "width: 100%;", ftemph.read(), count=1))
finally:
os.remove(ftemp)
def show_bokeh_nomargins(plot):
"""
Displays a bokeh plot/layout without having the left margin.
"""
ftemp = tempfile.mktemp()
try:
save_bokeh_nomargins(plot, ftemp)
webbrowser.open(ftemp)
time.sleep(1)
finally:
os.remove(ftemp)
私は、これは少しハックであることに注意しなければならない、とあなたはどこか他のwidth: 90%
を持っている場合、それはうまくいかないかもしれませんあなたのファイルに。