我有两个图...
vwc_fig = figure(plot_width=1200, plot_height=400, title="Volumetric Water Content",
x_axis_type="datetime",
)
vwc_fig2 = figure(plot_width=1200, plot_height=400, title="Volumetric Water Content",
x_axis_type="datetime",
)然后我设置了数据...
pr = vwc_fig.line(x="date_time", y="P3_VWC",
legend_label = 'pine road 45 cm',
line_color = 'blue',
source=pine_rd_df)
l = vwc_fig2.line(x="date_time", y="P3_VWC",
legend_label = 'lukens 28 cm',
line_color = 'green',
source=lukens_df)但我希望确保两个图的y轴是相同的范围,以便图具有可比性。有什么简单的方法可以做到这一点吗?
我试着创建第二个图形,使其y_range等于第一个图形...
vwc_fig = figure(plot_width=1200, plot_height=400, title="Volumetric Water Content",
x_axis_type="datetime",
)
vwc_fig2 = figure(plot_width=1200, plot_height=400, y_range=vwc_fig.y_range, title="Volumetric Water Content",
x_axis_type="datetime",
)但这并不管用。没有出现错误,图形看起来也没有什么不同。我还尝试了其他方法,如手动设置范围,但也不起作用。例如..。
vwc_fig2.yaxis.ticker = [10, 20, 37.4]
vwc_fig2.yaxis.bounds = [10, 37.4]更改滚动条或边界会导致y轴标签一起消失,但仍然没有出现错误。关于如何实现这一点,有什么建议吗?耽误您时间,实在对不起。
发布于 2021-08-17 12:30:27
bokeh中的范围由元组给定(min,max)指定。因此,在您的情况下,我将为两个图设置相同的y范围。
如您的示例所示,添加:
vwc_fig = figure(plot_width=1200, plot_height=400, title="Volumetric Water Content",
x_axis_type="datetime", y_range=(10, 37.4))
vwc_fig2 = figure(plot_width=1200, plot_height=400, title="Volumetric Water Content",
x_axis_type="datetime", y_range=(10, 37.4))然后两者应该有相同的y范围。
https://stackoverflow.com/questions/68731728
复制相似问题