上数据
Figure:相当于画板,画纸的载体
Axes/Subplot:相当于画纸
plot:相当于笔
一、绘图参数
更多参数详见官网链接
axes与axis的区别
另外一篇博客
另外一篇知乎
p.line(x, y, **kwargs)参数说明
x(:class:~bokeh.core.properties.NumberSpec ) : x坐标。
y(:class:~bokeh.core.properties.NumberSpec ) : y坐标。
line_alpha (:class:~bokeh.core.properties.NumberSpec ) : (default: 1.0) 轮廓线透明度。
line_cap ( :class:~bokeh.core.enums.LineCap ) : (default: ‘butt’) 线端。
line_color (:class:~bokeh.core.properties.ColorSpec ) : (default: ‘black’) 轮廓线颜色,默认:黑色。
line_dash (:class:~bokeh.core.properties.DashPattern ) : (default: []) 虚线,类型可以是序列,也可以是字符串(‘solid’, ‘dashed’, ‘dotted’, ‘dotdash’, ‘dashdot’)。
line_dash_offset (:class:~bokeh.core.properties.Int ) : (default: 0) 虚线偏移。
line_join (:class:~bokeh.core.enums.LineJoin ) : (default: ‘bevel’)。
line_width (:class:~bokeh.core.properties.NumberSpec ) : (default: 1) 线宽。
name (:class:~bokeh.core.properties.String ) : 图元名称。
tags (:class:~bokeh.core.properties.Any ) :图元标签。
alpha (float) : 一次性设置所有线条的透明度。
color (Color) : 一次性设置所有线条的颜色。
source (ColumnDataSource) : Bokeh特有数据格式(类似于Pandas Dataframe)。
legend (str) : 图元的图例。
x_range_name (str) : x轴范围名称。
y_range_name (str) : y轴范围名称。
level (Enum) : 图元渲染级别。
二、绘制单条曲线
# 1、设置中文编码和负号的正常显示
plt.rcParams['font.sans-serif'] = 'Microsoft YaHei'
plt.rcParams['axes.unicode_minus'] = False
#2、设置绘图风格
plt.style.use('ggplot')
#3、 设置图框的大小
fig = plt.figure(figsize=(8,5))
#4、绘制网格
Bokeh绘图详解
本文详细介绍了使用Bokeh进行绘图的各项参数配置,包括线条属性、颜色、透明度等,并展示了如何绘制单条曲线,涵盖了设置中文编码、负号显示、绘图风格及图框大小等实用技巧。
1478

被折叠的 条评论
为什么被折叠?



