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


Python models.DataRange1d方法代码示例

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


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

示例1: make_plot

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [as 别名]
def make_plot(source, title):
    plot = figure(x_axis_type="datetime", plot_width=800, tools="", toolbar_location=None)
    plot.title.text = title

    plot.quad(top='record_max_temp', bottom='record_min_temp', left='left', right='right',
              color=Blues4[2], source=source, legend="Record")
    plot.quad(top='average_max_temp', bottom='average_min_temp', left='left', right='right',
              color=Blues4[1], source=source, legend="Average")
    plot.quad(top='actual_max_temp', bottom='actual_min_temp', left='left', right='right',
              color=Blues4[0], alpha=0.5, line_color="black", source=source, legend="Actual")

    # fixed attributes
    plot.xaxis.axis_label = None
    plot.yaxis.axis_label = "Temperature (F)"
    plot.axis.axis_label_text_font_style = "bold"
    plot.x_range = DataRange1d(range_padding=0.0)
    plot.grid.grid_line_alpha = 0.3

    return plot 
开发者ID:binder-examples,项目名称:bokeh,代码行数:21,代码来源:main.py

示例2: make_plot

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [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

示例3: make_plot

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [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: __init__

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [as 别名]
def __init__(self, chart):
        self._chart = chart
        self._y_range_name = 'second_y'
        self._chart.figure.extra_y_ranges = {
            self._y_range_name: DataRange1d(bounds='auto')
        }
        # Add the appropriate axis type to the figure.
        axis_class = LinearAxis
        if self._chart._second_y_axis_type == 'log':
            axis_class = LogAxis
        self._chart.figure.add_layout(
            axis_class(y_range_name=self._y_range_name), 'right')

        self._y_axis_index = 1
        self._y_range = self._chart.figure.extra_y_ranges[self._y_range_name]
        self._chart.style._apply_settings('second_y_axis') 
开发者ID:spotify,项目名称:chartify,代码行数:18,代码来源:axes.py

示例5: create_stock

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [as 别名]
def create_stock(cls, source):

        # xdr1 = DataRange1d(sources=[source.columns("x")])
        # ydr1 = DataRange1d(sources=[source.columns("y")])

        # plot1 = figure(title="Outliers", x_range=xdr1, y_range=ydr1, plot_width=650, plot_height=400)
        stock_plot = figure(title="", plot_width=650, plot_height=400)
        # stock_plot.tools.append(TapTool(plot=stock_plot))
        # stock_plot.line(x="x", y="values", size=12, color="blue", line_dash=[2, 4], source=source)
        return stock_plot
        # plot1.scatter(x="x", y="y", size="size", fill_color="red", source=source) 
开发者ID:mvaz,项目名称:osqf2015,代码行数:13,代码来源:stock.py

示例6: plot_volume

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [as 别名]
def plot_volume(self, data: bt.AbstractDataBase, alpha=1.0, extra_axis=False):
        """extra_axis displays a second axis (for overlay on data plotting)"""
        source_id = FigureEnvelope._source_id(data)

        self._add_columns([(source_id + 'volume', np.float64), (source_id + 'colors_volume', np.object)])
        kwargs = {'fill_alpha': alpha,
                  'line_alpha': alpha,
                  'name': 'Volume',
                  'legend_label': 'Volume'}

        ax_formatter = NumeralTickFormatter(format=self._scheme.number_format)

        if extra_axis:
            source_data_axis = 'axvol'

            self.figure.extra_y_ranges = {source_data_axis: DataRange1d(
                range_padding=1.0/self._scheme.volscaling,
                start=0,
            )}

            # use colorup
            ax_color = convert_color(self._scheme.volup)

            ax = LinearAxis(y_range_name=source_data_axis, formatter=ax_formatter,
                            axis_label_text_color=ax_color, axis_line_color=ax_color, major_label_text_color=ax_color,
                            major_tick_line_color=ax_color, minor_tick_line_color=ax_color)
            self.figure.add_layout(ax, 'left')
            kwargs['y_range_name'] = source_data_axis
        else:
            self.figure.yaxis.formatter = ax_formatter

        vbars = self.figure.vbar('index', get_bar_width(), f'{source_id}volume', 0, source=self._cds, fill_color=f'{source_id}colors_volume', line_color="black", **kwargs)

        # make sure the new axis only auto-scales to the volume data
        if extra_axis:
            self.figure.extra_y_ranges['axvol'].renderers = [vbars]

        self._hoverc.add_hovertip("Volume", f"@{source_id}volume{{({self._scheme.number_format})}}", data) 
开发者ID:verybadsoldier,项目名称:backtrader_plotting,代码行数:40,代码来源:figureenvelope.py

示例7: plot_parallel

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [as 别名]
def plot_parallel(
    ax, diverging_mask, _posterior, var_names, figsize, backend_config, backend_kwargs, show
):
    """Bokeh parallel plot."""
    if backend_config is None:
        backend_config = {}

    backend_config = {
        **backend_kwarg_defaults(
            ("bounds_x_range", "plot.bokeh.bounds_x_range"),
            ("bounds_y_range", "plot.bokeh.bounds_y_range"),
        ),
        **backend_config,
    }

    if backend_kwargs is None:
        backend_kwargs = {}

    backend_kwargs = {
        **backend_kwarg_defaults(("dpi", "plot.bokeh.figure.dpi"),),
        **backend_kwargs,
    }
    dpi = backend_kwargs.pop("dpi")
    if ax is None:
        backend_kwargs.setdefault("width", int(figsize[0] * dpi))
        backend_kwargs.setdefault("height", int(figsize[1] * dpi))
        ax = bkp.figure(**backend_kwargs)

    non_div = list(_posterior[:, ~diverging_mask].T)
    x_non_div = [list(range(len(non_div[0]))) for _ in range(len(non_div))]

    ax.multi_line(
        x_non_div, non_div, line_color="black", line_alpha=0.05,
    )

    if np.any(diverging_mask):
        div = list(_posterior[:, diverging_mask].T)
        x_non_div = [list(range(len(div[0]))) for _ in range(len(div))]
        ax.multi_line(x_non_div, div, color="lime", line_width=1, line_alpha=0.5)

    ax.xaxis.ticker = FixedTicker(ticks=list(range(len(var_names))))
    ax.xaxis.major_label_overrides = dict(zip(map(str, range(len(var_names))), map(str, var_names)))
    ax.xaxis.major_label_orientation = np.pi / 2

    ax.x_range = DataRange1d(bounds=backend_config["bounds_x_range"], min_interval=2)
    ax.y_range = DataRange1d(bounds=backend_config["bounds_y_range"], min_interval=5)

    show_layout(ax, show)

    return ax 
开发者ID:arviz-devs,项目名称:arviz,代码行数:52,代码来源:parallelplot.py

示例8: plot

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import DataRange1d [as 别名]
def plot(xLabel='x',yLabel='y',*args):

    from bokeh.models import DataRange1d, Plot, LinearAxis, Grid
    from bokeh.models import PanTool, WheelZoomTool

    xdr = DataRange1d()
    ydr = DataRange1d()

    plot = Plot(x_range=xdr, y_range=ydr, min_border=80)

    extra = list()
    if type(xLabel) is not str and type(yLabel) is not str:
        extra.append(xLabel)
        extra.append(yLabel)
        xLabel = 'x'
        yLabel = 'y'
    elif type(xLabel) is not str: 
        extra.append(xLabel)
        xLabel = 'x'
    elif type(yLabel) is not str:
        extra.append(yLabel)
        yLabel = 'y'
   
    args = extra+list(args) 
    for renderer in args:
         if type(renderer) is not list: 
             plot.renderers.append(renderer)
         else: 
             plot.renderers.extend(renderer)

    #axes
    xaxis = LinearAxis(axis_label=xLabel)
    plot.add_layout(xaxis, 'below')
    yaxis = LinearAxis(axis_label=yLabel)
    plot.add_layout(yaxis, 'left')
    #add grid to the plot 
    #plot.add_layout(Grid(dimension=0, ticker=xaxis.ticker))
    #plot.add_layout(Grid(dimension=1, ticker=yaxis.ticker))

    #interactive tools
    plot.add_tools(PanTool(), WheelZoomTool()) #, SaveTool())

    return plot 
开发者ID:histogrammar,项目名称:histogrammar-python,代码行数:45,代码来源:bokeh.py


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