本文整理匯總了Python中bokeh.layouts方法的典型用法代碼示例。如果您正苦於以下問題:Python bokeh.layouts方法的具體用法?Python bokeh.layouts怎麽用?Python bokeh.layouts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bokeh
的用法示例。
在下文中一共展示了bokeh.layouts方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _get_figure
# 需要導入模塊: import bokeh [as 別名]
# 或者: from bokeh import layouts [as 別名]
def _get_figure(col):
"""Gets the bokeh.plotting.figure from a bokeh.layouts.column."""
from bokeh.layouts import column
from bokeh.plotting import figure
for children in col.children:
if isinstance(children, type(figure())):
return children
elif isinstance(children, type(column())):
return _get_figure(children)
示例2: line
# 需要導入模塊: import bokeh [as 別名]
# 或者: from bokeh import layouts [as 別名]
def line(self, x=None, y=None, **kwargs):
"""
Plot DataFrame columns as lines.
This function is useful to plot lines using DataFrame's values
as coordinates.
Parameters
----------
x : int or str, optional
Columns to use for the horizontal axis.
Either the location or the label of the columns to be used.
By default, it will use the DataFrame indices.
y : int, str, or list of them, optional
The values to be plotted.
Either the location or the label of the columns to be used.
By default, it will use the remaining DataFrame numeric columns.
**kwds
Keyword arguments to pass on to :meth:`pandas.DataFrame.plot_bokeh`.
Returns
-------
Bokeh.plotting.figure or Bokeh.layouts.row
Examples
--------
.. plot::
:context: close-figs
The following example shows the populations for some animals
over the years.
>>> df = pd.DataFrame({
... 'pig': [20, 18, 489, 675, 1776],
... 'horse': [4, 25, 281, 600, 1900]
... }, index=[1990, 1997, 2003, 2009, 2014])
>>> lines = df.plot_bokeh.line()
.. plot::
:context: close-figs
The following example shows the relationship between both
populations.
>>> lines = df.plot_bokeh.line(x='pig', y='horse')
"""
return self(kind="line", x=x, y=y, **kwargs)
示例3: step
# 需要導入模塊: import bokeh [as 別名]
# 或者: from bokeh import layouts [as 別名]
def step(self, x=None, y=None, **kwargs):
"""
Plot DataFrame columns as step lines.
This function is useful to plot step lines using DataFrame's values
as coordinates.
Parameters
----------
x : int or str, optional
Columns to use for the horizontal axis.
Either the location or the label of the columns to be used.
By default, it will use the DataFrame indices.
y : int, str, or list of them, optional
The values to be plotted.
Either the location or the label of the columns to be used.
By default, it will use the remaining DataFrame numeric columns.
**kwds
Keyword arguments to pass on to :meth:`pandas.DataFrame.plot_bokeh`.
Returns
-------
Bokeh.plotting.figure or Bokeh.layouts.row
Examples
--------
.. plot::
:context: close-figs
The following example shows the populations for some animals
over the years.
>>> df = pd.DataFrame({
... 'pig': [20, 18, 489, 675, 1776],
... 'horse': [4, 25, 281, 600, 1900]
... }, index=[1990, 1997, 2003, 2009, 2014])
>>> steps = df.plot_bokeh.step()
.. plot::
:context: close-figs
The following example shows the relationship between both
populations.
>>> steps = df.plot_bokeh.step(x='pig', y='horse')
"""
return self(kind="step", x=x, y=y, **kwargs)
示例4: point
# 需要導入模塊: import bokeh [as 別名]
# 或者: from bokeh import layouts [as 別名]
def point(self, x=None, y=None, **kwargs):
"""
Plot DataFrame columns as points.
This function is useful to plot lines using DataFrame's values
as coordinates.
Parameters
----------
x : int or str, optional
Columns to use for the horizontal axis.
Either the location or the label of the columns to be used.
By default, it will use the DataFrame indices.
y : int, str, or list of them, optional
The values to be plotted.
Either the location or the label of the columns to be used.
By default, it will use the remaining DataFrame numeric columns.
**kwds
Keyword arguments to pass on to :meth:`pandas.DataFrame.plot_bokeh`.
Returns
-------
Bokeh.plotting.figure or Bokeh.layouts.row
Examples
--------
.. plot::
:context: close-figs
The following example shows the populations for some animals
over the years.
>>> df = pd.DataFrame({
... 'pig': [20, 18, 489, 675, 1776],
... 'horse': [4, 25, 281, 600, 1900]
... }, index=[1990, 1997, 2003, 2009, 2014])
>>> lines = df.plot_bokeh.point()
.. plot::
:context: close-figs
The following example shows the relationship between both
populations.
>>> lines = df.plot_bokeh.point(x='pig', y='horse')
"""
return self(kind="point", x=x, y=y, **kwargs)