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 []:
import numpy as np
from bokeh.plotting import *
In []:
N = 80
In []:
x = np.linspace(0, 4*np.pi, N)
y = np.sin(x)
In []:
output_notebook()
In []:
figure(tools="pan,wheel_zoom,box_zoom,reset,previewsave")
In []:
# fixed width and height
rect(x, y, 4, 2, 
     width_units="screen", height_units="screen", 
     color="#ff0000"
)
show()
In []:
# variable width and height
rect(
    x, y, 0.01*np.exp(1+0.1*x), 0.2*abs(np.cos(x)),
    fill_color="green", line_color=None, fill_alpha=0.6
)
show()
In []:
# angle
rect(x, y, 0.05, 0.1, color="#4444aa", angle=-np.pi/6)
show()
In []:
 
Back to top