In [1]:
import numpy as np
In [2]:
from bokeh.plotting import figure, output_notebook, show
In [3]:
output_notebook()
Loading BokehJS ...
In [4]:
# define Bollinger bands
upperband = np.random.randint(100, 150, size=100)
lowerband = upperband - 100
x_data = np.arange(1, 101)
In [5]:
# shading glyph for Bollinger bands
band_x = np.append(x_data, x_data[::-1]) 
band_y = np.append(lowerband, upperband[::-1])  
In [6]:
p = figure(x_axis_type='datetime', title = 'Bollinger Bands')
p.x_range.range_padding = 0
p.plot_height = 600
p.plot_width = 800
p.grid.grid_line_alpha = 0.4
In [7]:
p.patch(band_x, band_y, color='#7570B3', fill_alpha=0.2)
Out[7]:
<bokeh.models.renderers.GlyphRenderer at 0x104a430f0>
In [8]:
show(p)
Out[8]:

<Bokeh Notebook handle for In[8]>

In [ ]: