📜  Bokeh-绘图工具

📅  最后修改于: 2020-11-09 05:14:28             🧑  作者: Mango


绘制散景图时,通常在图的右侧会出现一个工具栏。它包含一组默认工具。首先,可以通过Figure()函数的toolbar_location属性来配置工具栏的位置。此属性可以采用以下值之一-

  • “以上”
  • “下面”
  • “剩下”
  • “对”
  • “没有”

例如,以下语句将导致工具栏显示在图下方-

Fig = figure(toolbar_location = "below")

通过添加bokeh.models模块中定义的各种工具的要求,可以根据需要配置此工具栏。例如-

Fig.add_tools(WheelZoomTool())

这些工具可以分为以下类别-

  • 平移/拖动工具
  • 点击/点击工具
  • 滚动/捏工具
Tool Description Icon

BoxSelectTool

Name : ‘box_select’

allows the user to define a rectangular selection region by left-dragging a mouse BoxSelectTool

LassoSelectTool

name: ‘lasso_select

allows the user to define an arbitrary region for selection by left-dragging a mouse LassoSelectTool

PanTool

name: ‘pan’, ‘xpan’, ‘ypan’,

allows the user to pan the plot by left-dragging a mouse PanTool

TapTool

name: ‘tap

allows the user to select at single points by clicking a left mouse button TapTool

WheelZoomTool

name: ‘wheel_zoom’, ‘xwheel_zoom’, ‘ywheel_zoom’

zoom the plot in and out, centered on the current mouse location. WheelZoomTool

WheelPanTool

name: ‘xwheel_pan’, ‘ywheel_pan’

translate the plot window along the specified dimension without changing the window’s aspect ratio. WheelPanTool

ResetTool

name: ‘reset’

restores the plot ranges to their original values. ResetTool

SaveTool

name: ‘save’

allows the user to save a PNG image of the plot. SaveTool

ZoomInTool

name: ‘zoom_in’, ‘xzoom_in’, ‘yzoom_in’

The zoom-in tool will increase the zoom of the plot in x, y or both coordinates ZoomInTool

ZoomOutTool

name: ‘zoom_out’, ‘xzoom_out’, ‘yzoom_out’

The zoom-out tool will decrease the zoom of the plot in x, y or both coordinates ZoomInTool

CrosshairTool

name: ‘crosshair’

draws a crosshair annotation over the plot, centered on the current mouse position. ZoomInTool