什么是Bokeh的"屏幕单元"?

JS.*_*JS. 4 bokeh

在Bokeh,什么是"屏幕单位"?

网络对于这些生物是什么并不直接,我没有运气从(0.9.3)源代码中收集它们的意思

Bokeh源在其示例中使用它们,例如来自bokeh/_glyph_functions.py的'rect':

from bokeh.plotting import figure, output_file, show

plot = figure(width=300, height=300)
plot.rect(x=[1, 2, 3], y=[1, 2, 3], width=10, height=20, color="#CAB2D6",
          width_units="screen", height_units="screen")
show(plot)
Run Code Online (Sandbox Code Playgroud)

但我没有看到他们在任何地方定义."width_units"支持哪些其他选项?

Luk*_*van 5

Bokeh允许用户通过屏幕单位(与绘图原点的像素距离相关)或数据单位(使用用于根据输入数据计算绘图范围的映射器)设置渲染器位置

这有助于添加框注释,有时您希望将框链接到屏幕(可能始终位于屏幕中间)或链接到数据值(在x = 10处有一个框)

文档:https: //github.com/bokeh/bokeh/blob/master/bokeh/enums.py#L46