【发布时间】:2019-03-29 23:43:14
【问题描述】:
一个简单的散景图,第一个 y 轴最初是自动调整的。添加第二个 y 轴后,第一个 y 轴范围受到影响。
我无法为任一 y 轴使用固定的 y 轴范围,因为事先不知道限制。我使用 AjaxDataSource 将数据更新到绘图。
下面的程序演示了这个问题。更改 y3 中的值将更改第一个 y 轴范围。
from numpy import sin
from bokeh.plotting import output_file, figure, show
from bokeh.models import LinearAxis, Range1d, DataRange1d
x = [p/100 for p in range(0, 320)]
y = sin(x).tolist()
output_file("twin_axis.html")
p = figure()
p.line(x, y, color="red")
x1 = [0, 1.0, 2.2, 3.2]
y3 = [60, 70, 70, 70] # Changing these values affects first y-axis scale
p.extra_y_ranges = {"Yield": Range1d(start=0, end=50)} # tried DataRange1d(), no help
p.circle(x=x1, y=y3, color="blue", y_range_name="Yield")
p.add_layout(LinearAxis(y_range_name="Yield", axis_label="Yield(%)"), 'right')
show(p)
我正在使用散景 v1.0.4。
【问题讨论】:
标签: bokeh