python - 具有相同大小的散景网格图的问题
问题描述
我设法gridplot
在 Bokeh 中显示多个轴。但是在添加了颜色条和标签之后,地块的大小就不一样了。其中一些是狭窄的。我希望它们彼此具有相同的尺寸。我不确定这是否是由于标签和颜色条造成的。
for comp in idxComps: #adding labels
if comp % numCols == 0:
fig[comp].yaxis.axis_label = axLabel[1]
if comp >= (numRows-1) * numCols:
fig[comp].xaxis.axis_label = axLabel[0]
fig[comp].image(image=[values[..., comp].transpose()],
x=lower[0], y=lower[1],
dw=(upper[0]-lower[0]), dh=(upper[1]-lower[1]),
palette="Inferno256")
mapper = LinearColorMapper(palette='Inferno256',
low=np.amin(values[...,comp]),
high=np.amax(values[...,comp]))
color_bar = ColorBar(color_mapper=mapper,
width=7,
location=(0,0),
formatter=BasicTickFormatter(precision=1),
ticker=BasicTicker(desired_num_ticks=4),
label_standoff=12,
border_line_color=None) #adding a color bar
fig[comp].add_layout(color_bar, 'right')
gridplot(children=fig, toolbar_location=None, ncols=numCols, sizing_mode="scale_height", merge_tools=True)
解决方案
在 Bokeh 的最新版本(1.1 或更高版本)中,您可以显式传递frame_width
和frame_height
值来figure
控制“内部”绘图区域的尺寸。
推荐阅读
- powerbi - 创建具有多个结果的度量
- c# - 如何解决 .NET.CORE 中的代理服务器 407 错误
- opengl - 如何为球体的一部分生成几何图形
- javascript - 需要用 JavaScript 获取表中行的值
- python - 如何在 Odoo 网站中将选择字段显示为下拉菜单?
- c# - 获取 Swasbuckle 5 以输出 Swagger 2.0 Json 而不是 OpenAPI 3.0
- python - add_cuda_library 输出:未解析的外部函数
- c# - 如何解决 C# linq 中的转换数据类型错误
- html - 如何在:悬停检测后保持计数器递增?
- android - 仅在 Android 5.1 上尝试从空数组 com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ga 读取