我自己做一个直方图,每个条的总和是 1。所以每个条都小于 1。为什么它们不适合绘图窗口?我怎样才能做到这一点?
yaxis().bounds = [0,1]
这仅设置轴,但不适合我的情节。是否没有适当的散景文档,我对这些简单的问题很生气。
from bokeh.plotting import *
from __future__ import division
output_notebook()
from bokeh.plotting import rect
balkenbreite = 5
mitten = [10,20,30,40]
werte = [10,15,10,5]
anteil = []
sumVal = sum(werte)
for i in range(len(werte)):
anteil.append(0)
for i in range(len(anteil)):
anteil[i] = werte[i]/sumVal
print anteil
figure()
hold(False)
rect([mitten[0]],[anteil[0]/2], width=balkenbreite, height=anteil[0], plot_width=400, color = "#ff1200", plot_height=400, tools="pan")
hold(True)
for i in range(len(mitten)):
if i==0: continue
rect([mitten[i]],[anteil[i]/2], width=balkenbreite, height=anteil[i], plot_width=400, color = "#ff1200", plot_height=400)
xaxis()[0].axis_label="Areas"
yaxis()[0].axis_label="Frequency"
yaxis()[0].bounds = [0,1]
show()