当前位置: 首页>>代码示例>>Python>>正文


Python layouts.column方法代码示例

本文整理汇总了Python中bokeh.layouts.column方法的典型用法代码示例。如果您正苦于以下问题:Python layouts.column方法的具体用法?Python layouts.column怎么用?Python layouts.column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bokeh.layouts的用法示例。


在下文中一共展示了layouts.column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_plot

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def make_plot(self, dataframe):
        self.source = ColumnDataSource(data=dataframe)
        self.plot = figure(
            x_axis_type="datetime", plot_width=600, plot_height=300,
            tools='', toolbar_location=None)
        self.plot.quad(
            top='max_temp', bottom='min_temp', left='left', right='right',
            color=Blues4[2], source=self.source, legend='Magnitude')
        line = self.plot.line(
            x='date', y='avg_temp', line_width=3, color=Blues4[1],
            source=self.source, legend='Average')
        hover_tool = HoverTool(tooltips=[
            ('Value', '$y'),
            ('Date', '@date_readable'),
        ], renderers=[line])
        self.plot.tools.append(hover_tool)

        self.plot.xaxis.axis_label = None
        self.plot.yaxis.axis_label = None
        self.plot.axis.axis_label_text_font_style = 'bold'
        self.plot.x_range = DataRange1d(range_padding=0.0)
        self.plot.grid.grid_line_alpha = 0.3

        self.title = Paragraph(text=TITLE)
        return column(self.title, self.plot) 
开发者ID:GoogleCloudPlatform,项目名称:bigquery-bokeh-dashboard,代码行数:27,代码来源:temperature.py

示例2: make_plot

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def make_plot(self, dataframe):
        self.source = ColumnDataSource(data=dataframe)
        palette = all_palettes['Set2'][6]
        hover_tool = HoverTool(tooltips=[
            ("Value", "$y"),
            ("Year", "@year"),
        ])
        self.plot = figure(
            plot_width=600, plot_height=300, tools=[hover_tool],
            toolbar_location=None)
        columns = {
            'pm10': 'PM10 Mass (µg/m³)',
            'pm25_frm': 'PM2.5 FRM (µg/m³)',
            'pm25_nonfrm': 'PM2.5 non FRM (µg/m³)',
            'lead': 'Lead (¹/₁₀₀ µg/m³)',
        }
        for i, (code, label) in enumerate(columns.items()):
            self.plot.line(
                x='year', y=code, source=self.source, line_width=3,
                line_alpha=0.6, line_color=palette[i], legend=label)

        self.title = Paragraph(text=TITLE)
        return column(self.title, self.plot)
# [END make_plot] 
开发者ID:GoogleCloudPlatform,项目名称:bigquery-bokeh-dashboard,代码行数:26,代码来源:air.py

示例3: make_plot

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def make_plot(self, dataframe):
        self.source = ColumnDataSource(data=dataframe)
        self.plot = figure(
            x_axis_type="datetime", plot_width=400, plot_height=300,
            tools='', toolbar_location=None)

        vbar = self.plot.vbar(
            x='date', top='prcp', width=1, color='#fdae61', source=self.source)
        hover_tool = HoverTool(tooltips=[
            ('Value', '$y'),
            ('Date', '@date_readable'),
        ], renderers=[vbar])
        self.plot.tools.append(hover_tool)

        self.plot.xaxis.axis_label = None
        self.plot.yaxis.axis_label = None
        self.plot.axis.axis_label_text_font_style = 'bold'
        self.plot.x_range = DataRange1d(range_padding=0.0)
        self.plot.grid.grid_line_alpha = 0.3

        self.title = Paragraph(text=TITLE)
        return column(self.title, self.plot) 
开发者ID:GoogleCloudPlatform,项目名称:bigquery-bokeh-dashboard,代码行数:24,代码来源:precipitation.py

示例4: modify_doc

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def modify_doc(doc):
    df = sea_surface_temperature.copy()
    source = ColumnDataSource(data=df)

    plot = figure(x_axis_type='datetime', y_range=(0, 25), y_axis_label='Temperature (Celsius)',
                  title="Sea Surface Temperature at 43.18, -70.43")
    plot.line('time', 'temperature', source=source)

    def callback(attr, old, new):
        if new == 0:
            data = df
        else:
            data = df.rolling('{0}D'.format(new)).mean()
        source.data = ColumnDataSource(data=data).data

    slider = Slider(start=0, end=30, value=0, step=1, title="Smoothing by N Days")
    slider.on_change('value', callback)

    doc.add_root(column(slider, plot))

    # doc.theme = Theme(filename="theme.yaml") 
开发者ID:pythonstock,项目名称:stock,代码行数:23,代码来源:tornado_bokeh_embed.py

示例5: create

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def create(self):
        for _ in range(self.num_cameras):
            cam = BokehEventViewerCamera(self)
            cam.enable_pixel_picker(self.num_waveforms)
            cam.create_view_widget()
            cam.update_view_widget()
            cam.add_colorbar()

            self.cameras.append(cam)
            self.camera_layouts.append(cam.layout)

        for iwav in range(self.num_waveforms):
            wav = BokehEventViewerWaveform(self)
            active_color = self.cameras[0].active_colors[iwav]
            wav.fig.select(name="line")[0].glyph.line_color = active_color
            wav.enable_time_picker()
            wav.create_view_widget()
            wav.update_view_widget()

            self.waveforms.append(wav)
            self.waveform_layouts.append(wav.layout)

        self.layout = layout(
            [[column(self.camera_layouts), column(self.waveform_layouts)],]
        ) 
开发者ID:cta-observatory,项目名称:ctapipe,代码行数:27,代码来源:bokeh_event_viewer.py

示例6: modify_doc

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def modify_doc(doc):
    df = sea_surface_temperature.copy()
    source = ColumnDataSource(data=df)

    plot = figure(x_axis_type='datetime', y_range=(0, 25), y_axis_label='Temperature (Celsius)',
                  title="Sea Surface Temperature at 43.18, -70.43")
    plot.line('time', 'temperature', source=source)

    def callback(attr, old, new):
        if new == 0:
            data = df
        else:
            data = df.rolling('{0}D'.format(new)).mean()
        source.data = ColumnDataSource(data=data).data

    slider = Slider(start=0, end=30, value=0, step=1, title="Smoothing by N Days")
    slider.on_change('value', callback)

    doc.add_root(column(slider, plot))

    doc.theme = Theme(filename="theme.yaml") 
开发者ID:andrewcooke,项目名称:choochoo,代码行数:23,代码来源:test_bokeh_server.py

示例7: _plot_budget

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def _plot_budget(self, df):
        limits = OrderedDict([('cost', {'lower': df['cost'].min(),
                                        'upper': df['cost'].max()})])
        for hp in self.runscontainer.scenario.cs.get_hyperparameters():
            if isinstance(hp, NumericalHyperparameter):
                limits[hp.name] = {'lower': hp.lower, 'upper': hp.upper}
                if hp.log:
                    limits[hp.name]['log'] = True
            elif isinstance(hp, CategoricalHyperparameter):
                # We pass strings as numbers and overwrite the labels
                df[hp.name].replace({v: i for i, v in enumerate(hp.choices)}, inplace=True)
                limits[hp.name] = {'lower': 0, 'upper': len(hp.choices) - 1, 'choices': hp.choices}
            else:
                raise ValueError("Hyperparameter %s of type %s causes undefined behaviour." % (hp.name, type(hp)))
        p = parallel_plot(df=df, axes=limits, color=df[df.columns[0]], palette=Viridis256)
        div = Div(text="Select up and down column grid lines to define filters. Double click a filter to reset it.")
        plot = column(div, p)
        return plot 
开发者ID:automl,项目名称:CAVE,代码行数:20,代码来源:parallel_coordinates.py

示例8: create_files_signal

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def create_files_signal(files, use_dir_name=False):
    global selected_file
    new_signal_files = []
    for idx, file_path in enumerate(files):
        signals_file = SignalsFile(str(file_path), plot=plot, use_dir_name=use_dir_name)
        signals_files[signals_file.filename] = signals_file
        new_signal_files.append(signals_file)

    filenames = [f.filename for f in new_signal_files]

    if files_selector.options[0] == "":
        files_selector.options = filenames
    else:
        files_selector.options = files_selector.options + filenames
    files_selector.value = filenames[0]
    selected_file = new_signal_files[0]

    # update x axis according to the file's default x-axis (which is the index, and thus the first column)
    idx = x_axis_options.index(new_signal_files[0].csv.columns[0])
    change_x_axis(idx)
    x_axis_selector.active = idx 
开发者ID:NervanaSystems,项目名称:coach,代码行数:23,代码来源:experiment_board.py

示例9: home_handler

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def home_handler(doc):
    data = {'x': [0, 1, 2, 3, 4, 5], 'y': [0, 10, 20, 30, 40, 50]}
    source = ColumnDataSource(data=data)

    plot = figure(x_axis_type="linear", y_range=(0, 50), title="Test App Bokeh + Channels Plot", height=250)
    plot.line(x="x", y="y", source=source)

    def callback(attr: str, old: Any, new: Any) -> None:
        if new == 1:
            data['y'] = [0, 10, 20, 30, 40, 50]
        else:
            data['y'] = [i * new for i in [0, 10, 20, 30, 40, 50]]
        source.data = dict(ColumnDataSource(data=data).data)
        plot.y_range.end = max(data['y'])

    slider = Slider(start=1, end=5, value=1, step=1, title="Test App Bokeh + Channels Controller")
    slider.on_change("value", callback)

    doc.add_root(column(slider, plot)) 
开发者ID:tethysplatform,项目名称:tethys,代码行数:21,代码来源:controllers.py

示例10: update_display_data

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def update_display_data(self, patch_dict):
        # self.source.patch({'path': [(0, 'hello world')]})
        # self.original_source.patch({'path': [(0, 'hello world')]})
        # update data, use patch for updating specific location, use add for adding a new column
        #
        # 1. if we want to investigate new data, then we need to reload the website
        # 2. to incrementally add redis data to the graph, we should use ColumnDataSource.stream
        self.original_source.patch(patch_dict) 
开发者ID:osssanitizer,项目名称:osspolice,代码行数:10,代码来源:view.py

示例11: plot

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def plot(self, **kwargs) -> Tuple[figure, LayoutDOM]:
        """
        Build and plot a process tree.

        Parameters
        ----------
        schema : ProcSchema, optional
            The data schema to use for the data set, by default None
            (if None the schema is inferred)
        output_var : str, optional
            Output variable for selected items in the tree,
            by default None
        legend_col : str, optional
            The column used to color the tree items, by default None
        show_table: bool
            Set to True to show a data table, by default False.

        Other Parameters
        ----------------
        height : int, optional
            The height of the plot figure
            (the default is 700)
        width : int, optional
            The width of the plot figure (the default is 900)
        title : str, optional
            Title to display (the default is None)

        Returns
        -------
        Tuple[figure, LayoutDOM]:
            figure - The main bokeh.plotting.figure
            Layout - Bokeh layout structure.

        """
        return build_and_show_process_tree(data=self._df, **kwargs) 
开发者ID:microsoft,项目名称:msticpy,代码行数:37,代码来源:process_tree.py

示例12: build

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def build(self, schema: ProcSchema = None, **kwargs) -> pd.DataFrame:
        """
        Build process trees from the process events.

        Parameters
        ----------
        procs : pd.DataFrame
            Process events (Windows 4688 or Linux Auditd)
        schema : ProcSchema, optional
            The column schema to use, by default None
            If None, then the schema is inferred
        show_progress : bool
            Shows the progress of the process (helpful for
            very large data sets)
        debug : bool
            If True produces extra debugging output,
            by default False

        Returns
        -------
        pd.DataFrame
            Process tree dataframe.

        Notes
        -----
        It is not necessary to call this before `plot`. The process
        tree is built automatically. This is only needed if you want
        to return the processed tree data as a DataFrame

        """
        return build_process_tree(
            procs=self._df,
            schema=schema,
            show_progress=kwargs.get("show_progress", False),
            debug=kwargs.get("debug", False),
        ) 
开发者ID:microsoft,项目名称:msticpy,代码行数:38,代码来源:process_tree.py

示例13: _create_data_grouping

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def _create_data_grouping(data, source_columns, time_column, group_by, color):
    if not source_columns:
        data_columns = set(["NewProcessName", "EventID", "CommandLine"])
    else:
        data_columns = set(source_columns)
    tool_tip_columns = data_columns.copy()
    # If the time column not explicity specified in source_columns, add it
    data_columns.add(time_column)
    # create group frame so that we can color each group separately
    if group_by:
        group_count_df = (
            data[[group_by, time_column]]
            .groupby(group_by)
            .count()
            .reset_index()
            .rename(columns={time_column: "count"})
        )
        group_count_df["y_index"] = group_count_df.index

        # Shift the Viridis palatte so we lose the top, harder-to-see colors
        series_count = len(group_count_df)
        colors, palette_size = _get_color_palette(series_count)
        group_count_df["color"] = group_count_df.apply(
            lambda x: colors[x.y_index % palette_size], axis=1
        )
        # re-join with the original data
        data_columns.update([group_by, "y_index", "color"])
        clean_data = data.drop(columns=["y_index", "color"], errors="ignore")
        graph_df = clean_data.merge(group_count_df, on=group_by)[list(data_columns)]
    else:
        graph_df = data[list(data_columns)].copy()
        graph_df["color"] = color
        graph_df["y_index"] = 1
        series_count = 1
        group_count_df = None
    return graph_df, group_count_df, tool_tip_columns, series_count


# pylint: enable=too-many-arguments 
开发者ID:microsoft,项目名称:msticpy,代码行数:41,代码来源:timeline.py

示例14: make_plot

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def make_plot(self, dataframe):
        self.source = ColumnDataSource(data=dataframe)
        self.title = Paragraph(text=TITLE)
        self.data_table = DataTable(source=self.source, width=390, height=275, columns=[
            TableColumn(field="zipcode", title="Zipcodes", width=100),
            TableColumn(field="population", title="Population", width=100, formatter=NumberFormatter(format="0,0")),
            TableColumn(field="city", title="City")
        ])
        return column(self.title, self.data_table) 
开发者ID:GoogleCloudPlatform,项目名称:bigquery-bokeh-dashboard,代码行数:11,代码来源:population.py

示例15: PlotWidget

# 需要导入模块: from bokeh import layouts [as 别名]
# 或者: from bokeh.layouts import column [as 别名]
def PlotWidget(*args, **kw):
    return column(name=kw['name']) 
开发者ID:ioam,项目名称:parambokeh,代码行数:4,代码来源:widgets.py


注:本文中的bokeh.layouts.column方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。