Python中的 bokeh.plotting.figure.dash()函数
散景 是一个Python数据可视化库,提供高性能的交互式图表和绘图,输出可以在笔记本、Html 和服务器等各种媒体中获得。 Figure 类创建一个新的 Figure 用于绘图。它是 Plot 的子类,使用默认轴、网格、工具等简化绘图创建。
bokeh.plotting.figure.dash()函数
bokeh 库的绘图模块中的dash()函数用于配置和添加 Dash 字形到此图。
Syntax: dash(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)
Parameters: This method accept the following parameters that are described below:
- x: This parameter is the x-coordinates for the center of the markers.
- y: This parameter is the y-coordinates for the center of the markers.
- size: This parameter is the size (diameter) values for the markers in screen space units.
- angle: This parameter is the angles to rotate the markers.
- fill_color: This parameter is the fill color values for the markers.
- line_color: This parameter is the line color values for the markers with default value of black.
- line_width: This parameter is the line width values for the markers with default value of 1.
- name: This parameter is the user-supplied name for this model.
- tags: This parameter is the user-supplied values for this model.
Return: This method return the GlyphRenderer value.
下面的示例说明了 bokeh.plotting 中的 bokeh.plotting.figure.dash()函数:
示例 1:
Python3
# 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.dash(x = [1, 2, 3], y = [3, 7, 5],
size = 20, color ="green", alpha = 0.9)
show(plot)
Python3
# Implementation of bokeh function
import numpy as np
from bokeh.plotting import figure, output_file, show
x = [1, 2, 3, 4, 5]
y = [6, 7, 8, 7, 3]
output_file("geeksforgeeks.html")
p = figure(plot_width = 300, plot_height = 300)
# add both a line and circles on the
# same plot
p.line(x, y, line_width = 2)
p.dash(x, y, fill_color ="red",
line_color ="green", size = 25)
show(p)
输出:
示例 2:
Python3
# Implementation of bokeh function
import numpy as np
from bokeh.plotting import figure, output_file, show
x = [1, 2, 3, 4, 5]
y = [6, 7, 8, 7, 3]
output_file("geeksforgeeks.html")
p = figure(plot_width = 300, plot_height = 300)
# add both a line and circles on the
# same plot
p.line(x, y, line_width = 2)
p.dash(x, y, fill_color ="red",
line_color ="green", size = 25)
show(p)
输出: