📜  Bokeh-矩形,椭圆形和多边形

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


可以在散景图中渲染矩形,椭圆形和多边形。 Figure类的rect()方法基于中心,宽度和高度的x和y坐标添加一个矩形字形。另一方面,square()方法具有size参数来确定尺寸。

ellipse()和椭圆形()方法添加一个椭圆形和卵形字形。它们使用与具有x,y,w和h参数的rect()类似的签名。另外,角度参数确定从水平方向旋转。

以下代码显示了不同形状字形方法的使用

from bokeh.plotting import figure, output_file, show
fig = figure(plot_width = 300, plot_height = 300)
fig.rect(x = 10,y = 10,width = 100, height = 50, width_units = 'screen', height_units = 'screen')
fig.square(x = 2,y = 3,size = 80, color = 'red')
fig.ellipse(x = 7,y = 6, width = 30, height = 10, fill_color = None, line_width = 2)
fig.oval(x = 6,y = 6,width = 2, height = 1, angle = -0.4)
show(fig)

输出

多边形