In [1]:
!which python
In [3]:
!python --version
In [2]:
!git branch
In [5]:
import numpy as np
from bokeh.plotting import figure, show, output_notebook, curdoc, vplot, hplot
output_notebook()
In [6]:
x = np.linspace(0, 4*np.pi, 100)
y = np.sin(x)
p = figure()
r1 = p.line([0, 4*np.pi], [-1, 1], color="firebrick")
r2 = p.line(x, y, color="navy", line_width=4)
Typing r1.
and then shift-Tab
three times I get the following information:
Type: GlyphRenderer
String form: GlyphRenderer, ViewModel:GlyphRenderer, ref _id: aba6ffb6-455d-4dba-9790-16d0d608e3b5
File: ~/anaconda/envs/py35/lib/python3.5/site-packages/bokeh/models/renderers.py
Docstring:
Go to the renderers.py file and look at the code for GlyphRenderer
to find its attributes.
Now do the same with r1.glyph.
to find its properties by looking in the file referenced below:
Type: Line
String form: Line, ViewModel:Line, ref _id: 88845913-46b5-427b-9381-e373ed0c6080
File: ~/anaconda/envs/py35/lib/python3.5/site-packages/bokeh/models/glyphs.py
Docstring:
Render a single line.
.. note::
The ``Line`` glyph is different from most other glyphs in that
the vector of values only produces one glyph on the Plot.
There's not much in the definition of the Line
class, but it's immediate parent does have one (and only one) attribute that is interesting: visible
. Let' try it out.
In [7]:
show(p)
In [8]:
r1.glyph.visible = False
show(p)
In [9]:
r1.glyph.visible = True
r2.glyph.visible = False
show(p)
In [12]:
r2.glyph.visible = True
r2.glyph.trigger('visible',False,True)
In [13]:
show(p)
In [ ]: