This IPython Notebook contains simple examples of the rect function. To clear all previously rendered cell outputs, select from the menu: Cell -> All Output -> Clear
In [1]:
import numpy as np
from bokeh.plotting import figure, output_notebook, show
In [2]:
N = 80
In [3]:
x = np.linspace(0, 4*np.pi, N)
y = np.sin(x)
In [4]:
output_notebook()
Loading BokehJS ...
In [5]:
# fixed width and height
p1 = figure(title="width/height screen units")
p1.rect(x, y, 6, 4, color="tomato", width_units="screen", height_units="screen")
show(p1)
Out[5]:

<Bokeh Notebook handle for In[5]>

In [6]:
# variable width and height
w = 0.02*np.exp(1+0.1*x)
h = 0.2*abs(np.cos(x))
p2 = figure(title="variable width/height")
p2.rect(x, y, w, h, color="olivedrab", alpha=0.6)
show(p2)
Out[6]:

<Bokeh Notebook handle for In[6]>

In [7]:
# angle
a = -np.pi/6
p3 = figure(title="angle")
p3.rect(x, y, 0.1, 0.1, alpha=0.5, color="navy", angle=a)
show(p3)
Out[7]:

<Bokeh Notebook handle for In[7]>