python bokeh 示例_Python bokeh.plotting.figure.arc()用法及代码示例

Bokeh是Python中的数据可视化库,可提供高性能的交互式图表和绘图,并且可以通过笔记本,html和服务器等各种介质获取输出。 Figure类创建一个新的Figure进行绘制。它是Plot的子类,可通过默认轴,网格,工具等简化绘图创建。

bokeh.plotting.figure.arc()功能

散景库的绘图模块中的arc()功能用于配置Arc字形并将其添加到该图形中。

用法: arc(x, y, radius, start_angle, end_angle, direction=’anticlock’, *, end_angle_units=’rad’, line_alpha=1.0, line_cap=’butt’, line_color=’black’, line_dash=[], line_dash_offset=0, line_join=’bevel’, line_width=1, name=None, radius_units=’data’, start_angle_units=’rad’, tags=[], **kwargs)

参数:此方法接受下面描述的以下参数:

x:此参数是圆弧中心的x-coordinates。

y:此参数是圆弧中心的y-coordinates。

start_angle:此参数是开始弧的角度。

end_angle:此参数是结束弧的角度。

direction:此参数是在起始角度和终止角度之间的行程方向。

fill_alpha:此参数是圆弧的填充Alpha值。

fill_color:此参数是圆弧的填充颜色值。

line_alpha:此参数是步骤的线alpha值,默认值为1.0。

line_cap:此参数是默认值为对接的步骤的线宽值。

line_color:此参数是步骤的线条颜色值,默认值为黑色。

line_dash:此参数是步骤的线破折号,默认值为[]。

line_dash_offset:此参数是步骤的线破折号偏移值,默认值为0。

line_join:此参数是具有默认斜角值的步骤的线连接值。

line_width:此参数是步骤的线宽值,默认值为1。

mode:此参数可以是以下三个值之一:[“before”,“after”,“center”]。

name:此参数是此模型的用户提供的名称。

tags:此参数是该模型的用户提供的值。

Other Parameters:这些参数是** kwargs,如下所述:

alpha:此参数用于一次设置所有alpha关键字参数。

color:此参数用于一次设置所有颜色关键字参数。

legend_field:此参数是数据源中应使用的列或分组的名称。

legend_group:此参数是数据源中应使用的列或分组的名称。

legend_label:此参数是图例条目,其标记为此处提供的确切文本。

muted:此参数包含布尔值。

name:此参数是用户提供的可选名称,以附加到渲染器。

source:此参数是用户提供的数据源。

view:此参数是用于过滤数据源的视图。

visible:此参数包含布尔值。

x_range_name:此参数是用于映射x-coordinates的额外范围的名称。

y_range_name:此参数是用于映射y-coordinates的额外范围的名称。

level:此参数指定此字形的渲染级别顺序。

返回:此方法返回GlyphRenderer值。

以下示例说明了bokeh.plotting中的bokeh.plotting.figure.arc()函数:

范例1:

# Implementation of bokeh function

import numpy as np

from bokeh.plotting import figure, output_file, show

plot = figure(plot_width = 300, plot_height = 300)

plot.arc(x =[1, 2, 3], y =[3, 2, 1], radius = 0.3,

start_angle = 0.4, end_angle = 4.8,

color ="green", alpha = 0.6)

show(plot)

输出:

范例2:

# Implementation of bokeh function

import numpy as np

from bokeh.plotting import figure, output_file, show

N = 9

x = np.linspace(-2, 2, N)

y = x**2

r = x / 15.0 + 0.3

plot = figure(plot_width = 300, plot_height = 300)

plot.arc(x = x, y = y, radius = r,

start_angle = 0.6, end_angle = 4.8,

color ="green", alpha = 0.6, line_width = 3)

show(plot)

输出:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值