Bokeh - 扇形和弧形



arc() 方法根據 x 和 y 座標、起始角和結束角以及半徑繪製一條簡單的弧線。角度以弧度為單位,而半徑可能是螢幕單位或資料單位。扇形是一個填滿的圓弧。

wedge() 方法具有與 arc() 方法相同的屬性。這兩個方法都允許新增方向屬性(可為順時針或逆時針),它決定了繪製圓弧/扇形的方向。annular_wedge() 函式在內半徑和外半徑組成的圓弧之間繪製一個填充區域。

示例

下面是一個將圓弧扇形字形新增到 Bokeh 圖形中的示例 −

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)

輸出

wedge glyphs
廣告
© . All rights reserved.