Bokeh
pytao.plotting.bokeh
Classes
pytao.plotting.bokeh.BokehAppCreator
BokehAppCreator(manager, graphs, share_x=None, include_variables=False, grid=None, width=None, height=None, include_layout=False, graph_sizing_mode=None, layout_height=None, xlim=None, ylim=None)
A composite Bokeh application creator made up of 1 or more graphs.
This can be used to: * Generate a static HTML page without Python widgets * Generate a Notebook (or standalone) application with Python widgets
Interactive widgets will use the Tao
object to adjust variables during
callbacks resulting from user interaction.
Source code in pytao/plotting/bokeh.py
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 |
|
Functions
create_state()
Create an independent application state based on the graph data.
Source code in pytao/plotting/bokeh.py
1360 1361 1362 1363 1364 1365 1366 1367 1368 |
|
pytao.plotting.bokeh.BokehGraphManager
BokehGraphManager(tao)
Bases: GraphManager
Bokeh backend graph manager - for non-Jupyter contexts.
Source code in pytao/plotting/plot.py
1223 1224 1225 1226 |
|
Functions
plot(template, *, region_name=None, include_layout=True, sizing_mode=None, width=None, height=None, layout_height=None, share_x=None, xlim=None, ylim=None, save=None, curves=None, settings=None)
Plot a graph with Bokeh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template
|
str
|
Graph template name. |
required |
region_name
|
str
|
Graph region name. |
None
|
include_layout
|
bool
|
Include a layout plot at the bottom, if not already placed and if appropriate (i.e., another plot uses longitudinal coordinates on the x-axis). |
True
|
sizing_mode
|
Optional[SizingModeType]
|
Set the sizing mode for all graphs. Default is configured on a per-graph basis, typically "inherit". |
None
|
width
|
int
|
Width of each plot. |
None
|
height
|
int
|
Height of each plot. |
None
|
layout_height
|
int
|
Height of the layout plot. |
None
|
share_x
|
bool or None
|
Share x-axes where sensible ( |
None
|
xlim
|
(float, float)
|
X axis limits. |
None
|
ylim
|
(float, float)
|
Y axis limits. |
None
|
curves
|
Dict[int, TaoCurveSettings]
|
Dictionary of curve index to curve settings. These settings will be applied to the placed graph prior to plotting. |
None
|
settings
|
TaoGraphSettings
|
Graph customization settings. |
None
|
save
|
str or bool
|
Save the plot to a static HTML file with the given name.
If |
None
|
Returns:
Type | Description |
---|---|
list of graphs
|
|
BokehAppCreator
|
|
Source code in pytao/plotting/bokeh.py
1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 |
|
plot_field(ele_id, *, colormap=None, radius=0.015, num_points=100, x_scale=1.0, width=None, height=None, save=None)
Plot field information for a given element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ele_id
|
str
|
Element ID. |
required |
colormap
|
str
|
Colormap for the plot. Matplotlib defaults to "PRGn_r", and bokeh defaults to "". |
None
|
radius
|
float
|
Radius. |
0.015
|
num_points
|
int
|
Number of data points. |
100
|
width
|
int
|
|
None
|
height
|
int
|
|
None
|
save
|
Path or str
|
Save the plot to the given filename. |
None
|
Returns:
Type | Description |
---|---|
ElementField
|
|
figure
|
|
Source code in pytao/plotting/bokeh.py
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 |
|
plot_grid(templates, grid, *, include_layout=False, share_x=None, width=None, height=None, figsize=None, layout_height=None, xlim=None, ylim=None, curves=None, settings=None, save=None)
Plot graphs on a grid with Bokeh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
templates
|
list of str
|
Graph template names. |
required |
grid
|
(nrows, ncols)
|
Grid the provided graphs into this many rows and columns. |
required |
include_layout
|
bool
|
Include a layout plot at the bottom of each column. |
False
|
share_x
|
bool or None
|
Share x-axes where sensible ( |
None
|
figsize
|
(int, int)
|
Figure size. Alternative to specifying |
None
|
width
|
int
|
Width of the whole plot. |
None
|
height
|
int
|
Height of the whole plot. |
None
|
layout_height
|
int
|
Height of the layout plot. |
None
|
xlim
|
list of (float, float)
|
X axis limits for each graph. |
None
|
ylim
|
list of (float, float)
|
Y axis limits for each graph. |
None
|
curves
|
list of Dict[int, TaoCurveSettings]
|
One dictionary per graph, with each dictionary mapping the curve index to curve settings. These settings will be applied to the placed graphs prior to plotting. |
None
|
settings
|
list of TaoGraphSettings
|
Graph customization settings, per graph. |
None
|
save
|
Path or str
|
Save the plot to the given filename. |
None
|
Returns:
Type | Description |
---|---|
list of graphs
|
|
BokehAppCreator
|
|
Source code in pytao/plotting/bokeh.py
1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 |
|
to_bokeh_graph(graph)
Create a Bokeh graph instance from the backend-agnostic AnyGraph version.
For example, BasicGraph
becomes BokehBasicGraph
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph
|
AnyGraph
|
|
required |
Returns:
Type | Description |
---|---|
AnyBokehGraph
|
|
Source code in pytao/plotting/bokeh.py
1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 |
|
pytao.plotting.bokeh.NotebookGraphManager
NotebookGraphManager(tao)
Bases: BokehGraphManager
Jupyter notebook Bokeh backend graph manager.
Source code in pytao/plotting/plot.py
1223 1224 1225 1226 |
|
Functions
plot(template, *, region_name=None, include_layout=True, sizing_mode=None, width=None, height=None, layout_height=None, share_x=None, vars=False, xlim=None, ylim=None, notebook_handle=False, save=None, curves=None, settings=None)
Plot a graph with Bokeh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template
|
str
|
Graph template name. |
required |
region_name
|
str
|
Graph region name. |
None
|
include_layout
|
bool
|
Include a layout plot at the bottom, if not already placed and if appropriate (i.e., another plot uses longitudinal coordinates on the x-axis). |
True
|
sizing_mode
|
Optional[SizingModeType]
|
Set the sizing mode for all graphs. Default is configured on a per-graph basis, typically "inherit". |
None
|
width
|
int
|
Width of each plot. |
None
|
height
|
int
|
Height of each plot. |
None
|
layout_height
|
int
|
Height of the layout plot. |
None
|
share_x
|
bool or None
|
Share x-axes where sensible ( |
None
|
vars
|
bool
|
Show Tao variables as adjustable widgets, like "single mode". |
False
|
xlim
|
(float, float)
|
X axis limits. |
None
|
ylim
|
(float, float)
|
Y axis limits. |
None
|
curves
|
Dict[int, TaoCurveSettings]
|
Dictionary of curve index to curve settings. These settings will be applied to the placed graph prior to plotting. |
None
|
settings
|
TaoGraphSettings
|
Graph customization settings. |
None
|
save
|
str or bool
|
Save the plot to a static HTML file with the given name.
If |
None
|
Returns:
Type | Description |
---|---|
BokehAppCreator
|
|
Source code in pytao/plotting/bokeh.py
2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 |
|
plot_field(ele_id, *, colormap=None, radius=0.015, num_points=100, width=None, height=None, x_scale=1.0, save=None)
Plot field information for a given element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ele_id
|
str
|
Element ID. |
required |
colormap
|
str
|
Colormap for the plot. Matplotlib defaults to "PRGn_r", and bokeh defaults to "". |
None
|
radius
|
float
|
Radius. |
0.015
|
num_points
|
int
|
Number of data points. |
100
|
width
|
int
|
|
None
|
height
|
int
|
|
None
|
save
|
Path or str
|
Save the plot to the given filename. |
None
|
Source code in pytao/plotting/bokeh.py
2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 |
|
plot_grid(templates, grid, *, curves=None, settings=None, include_layout=False, share_x=None, vars=False, figsize=None, layout_height=None, xlim=None, ylim=None, width=None, height=None, save=None)
Plot graphs on a grid with Bokeh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
templates
|
list of str
|
Graph template names. |
required |
grid
|
(nrows, ncols)
|
Grid the provided graphs into this many rows and columns. |
required |
include_layout
|
bool
|
Include a layout plot at the bottom of each column. |
False
|
share_x
|
bool or None
|
Share x-axes where sensible ( |
None
|
vars
|
bool
|
Show Tao variables as adjustable widgets, like "single mode". |
False
|
figsize
|
(int, int)
|
Figure size. Alternative to specifying |
None
|
width
|
int
|
Width of the whole plot. |
None
|
height
|
int
|
Height of the whole plot. |
None
|
layout_height
|
int
|
Height of the layout plot. |
None
|
xlim
|
list of (float, float)
|
X axis limits for each graph. |
None
|
ylim
|
list of (float, float)
|
Y axis limits for each graph. |
None
|
curves
|
list of Dict[int, TaoCurveSettings]
|
One dictionary per graph, with each dictionary mapping the curve index to curve settings. These settings will be applied to the placed graphs prior to plotting. |
None
|
settings
|
list of TaoGraphSettings
|
Graph customization settings, per graph. |
None
|
save
|
Path or str
|
Save the plot to the given filename. |
None
|
Returns:
Type | Description |
---|---|
list of graphs
|
|
BokehAppCreator
|
|
Source code in pytao/plotting/bokeh.py
2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 |
|
Functions
pytao.plotting.bokeh.set_defaults
set_defaults(width=None, height=None, stacked_height=None, layout_height=None, palette=None, show_bokeh_logo=None, tools=None, grid_toolbar_location=None, lattice_layout_tools=None, floor_plan_tools=None, floor_plan_annotate_elements=None, layout_font_size=None, floor_plan_font_size=None, limit_scale_factor=None, max_data_points=None, variables_per_row=None, show_sliders=None, line_width_scale=None, floor_line_width_scale=None)
Change defaults used for Bokeh plots.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
Plot default width. |
None
|
height
|
int
|
Plot default height. |
None
|
stacked_height
|
int
|
Stacked plot default height ( |
None
|
layout_height
|
int
|
Layout plot height. |
None
|
palette
|
str
|
Palette for |
None
|
show_bokeh_logo
|
bool
|
Show Bokeh logo on each plot. |
None
|
tools
|
str
|
Bokeh tools to use. |
"pan,wheel_zoom,box_zoom,reset,hover,crosshair"
|
grid_toolbar_location
|
str
|
Toolbar location for gridded plots. |
"right"
|
lattice_layout_tools
|
str
|
Bokeh tools to use specifically for lattice layouts. |
None
|
floor_plan_tools
|
str
|
Bokeh tools to use specifically for floor plan layouts. |
None
|
layout_font_size
|
str
|
Font size to use in lattice layouts. |
None
|
floor_plan_font_size
|
str
|
Font size to use in floor plan layouts. |
None
|
limit_scale_factor
|
float
|
View limits from Tao are scaled by this factor. This can be used to ensure that all data is visible despite drawing method differences. |
1.01
|
max_data_points
|
int
|
Maximum number of data points to show in the slider. |
None
|
variables_per_row
|
int
|
Variables to list per row when in single mode (i.e., |
2
|
show_sliders
|
bool
|
Show sliders alongside the spinners in single mode. |
True
|
line_width_scale
|
float
|
Plot line width scaling factor applied to Tao's line width. |
1.0
|
floor_line_width_scale
|
float
|
Floor plan line width scaling factor applied to Tao's line width. |
0.5
|
Source code in pytao/plotting/bokeh.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|