Bokeh - 圓形符號



figure 物件擁有很多方法,可使用這些方法繪製不同形狀的向量化符號,例如圓、矩形、多邊形等。

以下方法可用於繪製圓形符號

circle()

circle() 方法將圓形符號新增到圖形中,並且需要其中心點的 x 和y 座標。此外,還可以藉助 fill_color、line_color、line_width 等引數對其進行配置。

circle_cross()

circle_cross() 方法新增的圓形符號在其中心點有一個“+”形交叉線。

circle_x()

circle_x() 方法新增的圓形符號在其中心點有一個“X”形交叉線。

示例

以下示例展示了在 Bokeh 圖形中新增各種圓形符號的用法 −

from bokeh.plotting import figure, output_file, show
plot = figure(plot_width = 300, plot_height = 300)
plot.circle(x = [1, 2, 3], y = [3,7,5], size = 20, fill_color = 'red')
plot.circle_cross(x = [2,4,6], y = [5,8,9], size = 20, fill_color = 'blue',fill_alpha = 0.2, line_width = 2)
plot.circle_x(x = [5,7,2], y = [2,4,9], size = 20, fill_color = 'green',fill_alpha = 0.6, line_width = 2)
show(plot)

輸出

circle cross
廣告
© . All rights reserved.