在 matplotlib 中要创建一个步骤函数,您可以编写如下内容:
import matplotlib.pyplot as plt
x = [1,2,3,4]
y = [0.002871972681775004, 0.00514787917410944,
0.00863476098280219, 0.012003316194034325]
plt.step(x, y)
plt.show()
Run Code Online (Sandbox Code Playgroud)
如何使用 Bokeh 制作类似的图表?
Step从版本开始,Bokeh 有一个内置字形0.12.11:
from bokeh.plotting import figure, output_file, show
output_file("line.html")
p = figure(plot_width=400, plot_height=400)
# add a steps renderer
p.step([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=2, mode="center")
show(p)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3363 次 |
| 最近记录: |