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


Python models.FactorRange方法代码示例

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


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

示例1: test_bokehplot

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_bokehplot():
    fruits = ['Apples', 'Pears', 'Nectarines', 'Plums', 'Grapes', 'Strawberries']
    years = ['2015', '2016', '2017']

    data = {'fruits': fruits,
            '2015': [2, 1, 4, 3, 2, 4],
            '2016': [5, 3, 3, 2, 4, 6],
            '2017': [3, 2, 4, 4, 5, 3]}

    x = [(fruit, year) for fruit in fruits for year in years]
    counts = sum(zip(data['2015'], data['2016'], data['2017']), ())  # like an hstack

    source = ColumnDataSource(data=dict(x=x, counts=counts))

    fig = figure(x_range=FactorRange(*x), plot_height=350, title="Fruit Counts by Year",
                 toolbar_location=None, tools="")
    fig.vbar(x='x', top='counts', width=0.9, source=source)
    return BokehPlotBlock(fig) 
开发者ID:man-group,项目名称:PyBloqs,代码行数:20,代码来源:test_image.py

示例2: create

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def create(self):
        self.source = self.update_source()

        max_data = max(max(self.source.data['relevant']), max(self.source.data['crawled']))
        xdr = Range1d(start=0, end=max_data)

        p = figure(plot_width=400, plot_height=400,
                   title="Domains Sorted by %s" % self.sort, x_range = xdr,
                   y_range = FactorRange(factors=self.source.data['domain']),
                   tools='reset, resize, save')

        p.rect(y='domain', x='crawled_half', width="crawled", height=0.75,
               color=DARK_GRAY, source =self.source, legend="crawled")
        p.rect(y='domain', x='relevant_half', width="relevant", height=0.75,
               color=GREEN, source =self.source, legend="relevant")

        p.ygrid.grid_line_color = None
        p.xgrid.grid_line_color = '#8592A0'
        p.axis.major_label_text_font_size = "8pt"

        script, div = components(p)

        if os.path.exists(self.crawled_data) and os.path.exists(self.relevant_data):
            return (script, div) 
开发者ID:nasa-jpl-memex,项目名称:memex-explorer,代码行数:26,代码来源:domain.py

示例3: test_points_errorbars_text_ndoverlay_categorical_xaxis

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_points_errorbars_text_ndoverlay_categorical_xaxis(self):
        overlay = NdOverlay({i: Points(([chr(65+i)]*10,np.random.randn(10)))
                             for i in range(5)})
        error = ErrorBars([(el['x'][0], np.mean(el['y']), np.std(el['y']))
                           for el in overlay])
        text = Text('C', 0, 'Test')
        plot = bokeh_renderer.get_plot(overlay*error*text)
        x_range = plot.handles['x_range']
        y_range = plot.handles['y_range']
        self.assertIsInstance(x_range, FactorRange)
        factors = ['A', 'B', 'C', 'D', 'E']
        self.assertEqual(x_range.factors, ['A', 'B', 'C', 'D', 'E'])
        self.assertIsInstance(y_range, Range1d)
        error_plot = plot.subplots[('ErrorBars', 'I')]
        for xs, factor in zip(error_plot.handles['source'].data['base'], factors):
            self.assertEqual(factor, xs) 
开发者ID:holoviz,项目名称:holoviews,代码行数:18,代码来源:testoverlayplot.py

示例4: test_curve_categorical_xaxis

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_curve_categorical_xaxis(self):
        curve = Curve((['A', 'B', 'C'], [1,2,3]))
        plot = bokeh_renderer.get_plot(curve)
        x_range = plot.handles['x_range']
        self.assertIsInstance(x_range, FactorRange)
        self.assertEqual(x_range.factors, ['A', 'B', 'C']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testcurveplot.py

示例5: test_curve_categorical_xaxis_invert_axes

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_curve_categorical_xaxis_invert_axes(self):
        curve = Curve((['A', 'B', 'C'], (1,2,3))).opts(plot=dict(invert_axes=True))
        plot = bokeh_renderer.get_plot(curve)
        y_range = plot.handles['y_range']
        self.assertIsInstance(y_range, FactorRange)
        self.assertEqual(y_range.factors, ['A', 'B', 'C']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testcurveplot.py

示例6: test_points_errorbars_text_ndoverlay_categorical_xaxis_invert_axes

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_points_errorbars_text_ndoverlay_categorical_xaxis_invert_axes(self):
        overlay = NdOverlay({i: Points(([chr(65+i)]*10,np.random.randn(10)))
                             for i in range(5)})
        error = ErrorBars([(el['x'][0], np.mean(el['y']), np.std(el['y']))
                           for el in overlay]).opts(plot=dict(invert_axes=True))
        text = Text('C', 0, 'Test')
        plot = bokeh_renderer.get_plot(overlay*error*text)
        x_range = plot.handles['x_range']
        y_range = plot.handles['y_range']
        self.assertIsInstance(x_range, Range1d)
        self.assertIsInstance(y_range, FactorRange)
        self.assertEqual(y_range.factors, ['A', 'B', 'C', 'D', 'E']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:14,代码来源:testoverlayplot.py

示例7: test_points_categorical_xaxis

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_points_categorical_xaxis(self):
        points = Points((['A', 'B', 'C'], (1,2,3)))
        plot = bokeh_renderer.get_plot(points)
        x_range = plot.handles['x_range']
        self.assertIsInstance(x_range, FactorRange)
        self.assertEqual(x_range.factors, ['A', 'B', 'C']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testpointplot.py

示例8: test_points_categorical_xaxis_invert_axes

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_points_categorical_xaxis_invert_axes(self):
        points = Points((['A', 'B', 'C'], (1,2,3))).opts(plot=dict(invert_axes=True))
        plot = bokeh_renderer.get_plot(points)
        y_range = plot.handles['y_range']
        self.assertIsInstance(y_range, FactorRange)
        self.assertEqual(y_range.factors, ['A', 'B', 'C']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testpointplot.py

示例9: test_points_overlay_categorical_xaxis

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_points_overlay_categorical_xaxis(self):
        points = Points((['A', 'B', 'C'], (1,2,3)))
        points2 = Points((['B', 'C', 'D'], (1,2,3)))
        plot = bokeh_renderer.get_plot(points*points2)
        x_range = plot.handles['x_range']
        self.assertIsInstance(x_range, FactorRange)
        self.assertEqual(x_range.factors, ['A', 'B', 'C', 'D']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:9,代码来源:testpointplot.py

示例10: test_points_overlay_categorical_xaxis_invert_axis

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_points_overlay_categorical_xaxis_invert_axis(self):
        points = Points((['A', 'B', 'C'], (1,2,3))).opts(plot=dict(invert_xaxis=True))
        points2 = Points((['B', 'C', 'D'], (1,2,3)))
        plot = bokeh_renderer.get_plot(points*points2)
        x_range = plot.handles['x_range']
        self.assertIsInstance(x_range, FactorRange)
        self.assertEqual(x_range.factors, ['A', 'B', 'C', 'D'][::-1]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:9,代码来源:testpointplot.py

示例11: test_points_overlay_categorical_xaxis_invert_axes

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_points_overlay_categorical_xaxis_invert_axes(self):
        points = Points((['A', 'B', 'C'], (1,2,3))).opts(plot=dict(invert_axes=True))
        points2 = Points((['B', 'C', 'D'], (1,2,3)))
        plot = bokeh_renderer.get_plot(points*points2)
        y_range = plot.handles['y_range']
        self.assertIsInstance(y_range, FactorRange)
        self.assertEqual(y_range.factors, ['A', 'B', 'C', 'D']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:9,代码来源:testpointplot.py

示例12: test_heatmap_categorical_axes_string_int

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_heatmap_categorical_axes_string_int(self):
        hmap = HeatMap([('A', 1, 1), ('B', 2, 2)])
        plot = bokeh_renderer.get_plot(hmap)
        x_range = plot.handles['x_range']
        y_range = plot.handles['y_range']
        self.assertIsInstance(x_range, FactorRange)
        self.assertEqual(x_range.factors, ['A', 'B'])
        self.assertIsInstance(y_range, Range1d)
        self.assertEqual(y_range.start, 0.5)
        self.assertEqual(y_range.end, 2.5) 
开发者ID:holoviz,项目名称:holoviews,代码行数:12,代码来源:testheatmapplot.py

示例13: test_heatmap_categorical_axes_string_int_inverted

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_heatmap_categorical_axes_string_int_inverted(self):
        hmap = HeatMap([('A',1, 1), ('B', 2, 2)]).opts(invert_axes=True)
        plot = bokeh_renderer.get_plot(hmap)
        x_range = plot.handles['x_range']
        y_range = plot.handles['y_range']
        self.assertIsInstance(x_range, Range1d)
        self.assertEqual(x_range.start, 0.5)
        self.assertEqual(x_range.end, 2.5)
        self.assertIsInstance(y_range, FactorRange)
        self.assertEqual(y_range.factors, ['A', 'B']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:12,代码来源:testheatmapplot.py

示例14: test_heatmap_points_categorical_axes_string_int

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_heatmap_points_categorical_axes_string_int(self):
        hmap = HeatMap([('A', 1, 1), ('B', 2, 2)])
        points = Points([('A', 2), ('B', 1),  ('C', 3)])
        plot = bokeh_renderer.get_plot(hmap*points)
        x_range = plot.handles['x_range']
        y_range = plot.handles['y_range']
        self.assertIsInstance(x_range, FactorRange)
        self.assertEqual(x_range.factors, ['A', 'B', 'C'])
        self.assertIsInstance(y_range, Range1d)
        self.assertEqual(y_range.start, 0.5)
        self.assertEqual(y_range.end, 3) 
开发者ID:holoviz,项目名称:holoviews,代码行数:13,代码来源:testheatmapplot.py

示例15: test_heatmap_points_categorical_axes_string_int_inverted

# 需要导入模块: from bokeh import models [as 别名]
# 或者: from bokeh.models import FactorRange [as 别名]
def test_heatmap_points_categorical_axes_string_int_inverted(self):
        hmap = HeatMap([('A',1, 1), ('B', 2, 2)]).opts(invert_axes=True)
        points = Points([('A', 2), ('B', 1),  ('C', 3)])
        plot = bokeh_renderer.get_plot(hmap*points)
        x_range = plot.handles['x_range']
        y_range = plot.handles['y_range']
        self.assertIsInstance(x_range, Range1d)
        self.assertEqual(x_range.start, 0.5)
        self.assertEqual(x_range.end, 3)
        self.assertIsInstance(y_range, FactorRange)
        self.assertEqual(y_range.factors, ['A', 'B', 'C']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:13,代码来源:testheatmapplot.py


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