问题都在标题中。我正在尝试使用从 bokeh.charts 导入的 Histogram 对象,但无法弄清楚如何以对数比例显示它。在我的特殊情况下,我需要以对数刻度显示 x 轴和 y 轴。
好吧,似乎可以有对数刻度。但是,我应该使用绘图 API,而不是使用图表 API:
import numpy as np
from bokeh.plotting import figure, show, output_notebook
output_notebook()
# generate random data from a powerlaw
measured = 1/np.random.power(2.5, 100000)
hist, edges = np.histogram(measured, bins=50)
p = figure(title="Power law (a=2.5)", x_axis_type="log", y_axis_type='log')
p.quad(top=hist, bottom=0, left=edges[:-1], right=edges[1:], line_color=None)
show(p)
Run Code Online (Sandbox Code Playgroud)
感谢 bigreddot 对另一个问题的帮助!
| 归档时间: |
|
| 查看次数: |
1307 次 |
| 最近记录: |