是否可以摆脱散景图像两侧的填充(或边距)? 我一直在看各种数字,他们似乎都有这个空白区域左侧。我也试图改变边界 例如:s1.min_border_left = 0 or change it to s1.min_border_left = 40
从散景图中删除填充或边距数字
,但它似乎并没有做的工作,它改变了边界,但不知何故似乎有一种填充是固定的,而不是多变,的一个例子我想摆脱的区域: Image example 所以有可能摆脱这一点,只是有图保持在浏览器的左侧?
是否可以摆脱散景图像两侧的填充(或边距)? 我一直在看各种数字,他们似乎都有这个空白区域左侧。我也试图改变边界 例如:s1.min_border_left = 0 or change it to s1.min_border_left = 40
从散景图中删除填充或边距数字
,但它似乎并没有做的工作,它改变了边界,但不知何故似乎有一种填充是固定的,而不是多变,的一个例子我想摆脱的区域: Image example 所以有可能摆脱这一点,只是有图保持在浏览器的左侧?
替换宽度90%如果使用背景虚化服务器,可以用像这样添加外部CSS片修改边距。
html, body {
display: block;
margin: 0 auto;
width: 99%;
}
开放生成的HTML页面,并用100%
基于其他的答案,这里是片段,可能会派上用场:
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%
其他地方可能会出问题在你的文件中。