<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Bokeh Structure Graph Example
The Bokeh Structure Graph allows one to browse a model and its submodels, and to investigate its attributes.
Step1:  Create a figure
First we create a figure to analyze.
Step2:  Simple Public API
Step3:  The  _BokehStructureGraph class
We create a BokehStructureGraph object from this figure.
Step4:  Properties of the Structure Graph
Networkx graph of submodels
There are three resources available from the BokehStructureGraph.  The first is a networkx graph
that has one mode for each submodel, identified by the model id, together with the name of that submodel.
Step5:  Dataframe of attributes with values, types, and docstrings
Next, there is a pandas dataframe that contains one entry for each attribute of each model, together with the value of the attribute, its type (a bokeh property) and its docstring.
Step6:  Graphical representation
Finally there is a bokeh model that displays the graphical structure of the model and its submodels.  Clicking on a node
reveals the attributes of that model and their values.
<ASSISTANT_TASK:>
Python Code:
import bokeh
from bokeh.models.util import generate_structure_plot
from bokeh.plotting import figure
from bokeh.io import output_notebook, show
output_notebook()
Explanation: Bokeh Structure Graph Example
The Bokeh Structure Graph allows one to browse a model and its submodels, and to investigate its attributes.
End of explanation
import numpy as np
X = np.linspace(-1,1,100)
Y = X + np.random.normal(size=X.shape)
f=figure(width=400,height=400)
_=f.line(x=X,y=Y,color='blue',line_width=3,alpha=.5)
_=f.line(x=X,y=X,color='red',line_width=3)
show(f)
Explanation: Create a figure
First we create a figure to analyze.
End of explanation
show(generate_structure_plot(f))
Explanation: Simple Public API
End of explanation
from bokeh.models.util import structure as st
BSG=st._BokehStructureGraph(f)
Explanation: The  _BokehStructureGraph class
We create a BokehStructureGraph object from this figure.
End of explanation
for x in BSG.graph.nodes(data=True):
    print(x)
Explanation: Properties of the Structure Graph
Networkx graph of submodels
There are three resources available from the BokehStructureGraph.  The first is a networkx graph
that has one mode for each submodel, identified by the model id, together with the name of that submodel.
End of explanation
BSG.property_df
BSG.property_df['doc']=BSG.property_df['doc'].str.replace('\n','')
pd.set_option('max_colwidth',None)
BSG.property_df
Explanation: Dataframe of attributes with values, types, and docstrings
Next, there is a pandas dataframe that contains one entry for each attribute of each model, together with the value of the attribute, its type (a bokeh property) and its docstring.
End of explanation
show(BSG.model)
Explanation: Graphical representation
Finally there is a bokeh model that displays the graphical structure of the model and its submodels.  Clicking on a node
reveals the attributes of that model and their values.
End of explanation
<END_TASK>