📜  Bokeh-专用曲线

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


bokeh.plotting API支持用于渲染特定曲线的方法-

beizer()

此方法将Bézier曲线添加到图形对象。贝塞尔曲线是计算机图形学中使用的参数曲线。其他用途包括计算机字体和动画的设计,用户界面设计以及用于平滑光标轨迹的设计。

在矢量图形中,贝塞尔曲线用于建模可以无限缩放的平滑曲线。 “路径”是链接的贝塞尔曲线的组合。

beizer()方法具有以下定义的参数-

1 x0 The x-coordinates of the starting points.
2 y0 The y-coordinates of the starting points..
3 x1 The x-coordinates of the ending points.
4 y1 The y-coordinates of the ending points.
5 cx0 The x-coordinates of first control points.
6 cy0 The y-coordinates of first control points.
7 cx1 The x-coordinates of second control points.
8 cy1 The y-coordinates of second control points.

所有参数的默认值为“无”。

以下代码生成一个HTML页面,该页面显示Bokeh图中的贝塞尔曲线和抛物线-

x = 2
y = 4
xp02 = x+0.4
xp01 = x+0.1
xm01 = x-0.1
yp01 = y+0.2
ym01 = y-0.2
fig = figure(plot_width = 300, plot_height = 300)
fig.bezier(x0 = x, y0 = y, x1 = xp02, y1 = y, cx0 = xp01, cy0 = yp01,
cx1 = xm01, cy1 = ym01, line_color = "red", line_width = 2)

输出

比泽

二次()

此方法在散景图中添加了抛物线字形。该函数的参数与beizer()相同,除了cx0cx1之外

下面给出的代码生成二次曲线。

x = 2
y = 4
xp02 = x + 0.3
xp01 = x + 0.2
xm01 = x - 0.4
yp01 = y + 0.1
ym01 = y - 0.2
x = x,
y = y,
xp02 = x + 0.4,
xp01 = x + 0.1,
yp01 = y + 0.2,
fig.quadratic(x0 = x, y0 = y, x1 = x + 0.4, y1 = y + 0.01, cx = x + 0.1,
cy = y + 0.2, line_color = "blue", line_width = 3)

输出

二次的