当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python bokeh.plotting.figure.asterisk()用法及代码示例


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

bokeh.plotting.figure.asterisk()函数

散景库的绘图模块中的asterisk()函数用于配置星号字形并将其添加到该图形中。

用法: asterisk(x, y, size=4, angle=0.0, *, angle_units=’rad’, fill_alpha=1.0, fill_color=’gray’, line_alpha=1.0, line_cap=’butt’, line_color=’black’, line_dash=[], line_dash_offset=0, line_join=’bevel’, line_width=1, name=None, tags=[], **kwargs)

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

  • x:此参数是标记中心的x-coordinates。
  • y:此参数是标记中心的y-coordinates。
  • size:此参数是屏幕空间单位中标记的大小(直径)值。
  • angle:此参数是旋转标记的角度。
  • 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.asterisk()函数:
范例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.asterisk(x =[1, 2, 3], y =[3, 2, 1], size = 30, 
         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
sizes = np.linspace(20, 50, N) 
  
plot = figure(plot_width = 300, plot_height = 300) 
plot.asterisk(x = x, y = y, size = sizes, 
         color ="green", alpha = 0.6, line_width = 3) 
   
show(plot)

输出:




相关用法


注:本文由纯净天空筛选整理自SHUBHAMSINGH10大神的英文原创作品 bokeh.plotting.figure.asterisk() function in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。