玖叶教程网

前端编程开发入门

Python 绘图库——bokeh(python图形绘制库)

import numpy as np

from bokeh.plotting import figure, output_file, show

N = 500
x = np.linspace(0, 10, N)
y = np.linspace(0, 10, N)
xx, yy = np.meshgrid(x, y)
d = np.sin(xx)*np.cos(yy)

p = figure(tooltips=[("x", "$x"), ("y", "$y"), ("value", "@image")])
p.x_range.range_padding = p.y_range.range_padding = 0

# must give a vector of image data for image parameter
p.image(image=[d], x=0, y=0, dw=10, dh=10, palette="Spectral11", level="image")
p.grid.grid_line_width = 0.5

output_file("image.html", title="image.py example")

show(p)

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言