Making a histogram on my own, the sum of each bars is 1. So each bar is smaller than 1. Why don't they fit into the plot window? How can I achieve this?
yaxis().bounds = [0,1]
This only sets the axis, but doesn't fit my plot. Is there no proper documentation for bokeh, I am getting mad on such simple problems.
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()

Note (4/8/2014): Bokeh is still under early but active development, so these kinds of questions are to be expected for the time being. We hope to answer them as quickly as possible as we continue to expand our documentation, but in the meantime you may find the tutorials to be helpful.
To the question at hand: currently plot ranges can be set with the Range1d object, which is assigned to the x_range or y_range keyword arguments. These can be set on the figure() instance.
These three lines should fix the issue:
from bokeh.objects import Range1d
yr = Range1d(start=0, end=1)
figure(y_range=yr)
Edit: here's a screenshot of what I imagine you want.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With