Bokeh 简明教程
Bokeh - Wedges and Arcs
arc() method 基于 x 和 y 坐标、起始和结束角度以及半径绘制一个简单的线弧。角度以弧度给出,而半径可能以屏幕单位或数据单位给出。扇形是一个填充的圆弧。
The arc() method draws a simple line arc based on x and y coordinates, start and end angles and radius. Angles are given in radians whereas radius may be in screen units or data units. The wedge is a filled arc.
wedge() method 的属性与 arc() 方法相同。两种方法都提供了可选的方向属性,可以是顺时针或逆时针,它确定了圆弧/扇形渲染的方向。annular_wedge() 函数渲染一个填充在内部和外部半径圆弧之间的区域。
The wedge() method has same properties as arc() method. Both methods have provision of optional direction property which may be clock or anticlock that determines the direction of arc/wedge rendering. The annular_wedge() function renders a filled area between to arcs of inner and outer radius.
Example
以下是添加到 Bokeh 图形中的 arc 和 wedge glyphs 的示例 −
Here is an example of arc and wedge glyphs added to Bokeh figure −
from bokeh.plotting import figure, output_file, show
import math
fig = figure(plot_width = 300, plot_height = 300)
fig.arc(x = 3, y = 3, radius = 50, radius_units = 'screen', start_angle = 0.0, end_angle = math.pi/2)
fig.wedge(x = 3, y = 3, radius = 30, radius_units = 'screen',
start_angle = 0, end_angle = math.pi, direction = 'clock')
fig.annular_wedge(x = 3,y = 3, inner_radius = 100, outer_radius = 75,outer_radius_units = 'screen',
inner_radius_units = 'screen',start_angle = 0.4, end_angle = 4.5,color = "green", alpha = 0.6)
show(fig)