• 朝韩将军级会谈时隔11年后在板门店重启 2019-07-23
  • Conférence de presse du Premier ministre chinois 2019-07-09
  • 大观园举办“古琴雅集” 市民感受“古韵端午” 2019-06-30
  • 文脉颂中华——黄河新闻网 2019-06-30
  • 水费欠账竟“穿越”16年?用户质疑:为何没见催缴过? 2019-06-21
  • 买房怎么看风水这个真的实在是太重要了 ——凤凰网房产北京 2019-06-11
  • 6月14日凤凰直通车:茅台再开市场化招聘大门,32个部门要285人葡萄 种植 2019-06-07
  • 习近平为传统文化“代言” 2019-05-27
  • 中巴建交一周年 一系列庆祝活动在巴拿马举行 2019-05-24
  • 招聘启事丨西部网诚聘新媒体编辑记者、实习编辑等人员 2019-05-23
  • A title= href=httpwww.snrtv.comlivech=8 target= 2019-05-23
  • 不止消灭刘海屏 vivo NEX发布会看点汇总 2019-05-22
  • 世相【镜头中的陕西人】 2019-05-20
  • 邓紫棋首任明星制作人 吴亦凡身兼二职 2019-05-20
  • 陶昕然女儿正面照曝光 吃蛋糕萌到爆 2019-05-19
  • 山西体彩十一选五遗漏:Bokeh Tutorial

    00. Introduction and Setup

    What is Bokeh

    Bokeh is an interactive visualization library that targets modern web browsers for presentation. It is good for:

    • Interactive visualization in modern browsers
    • Standalone HTML documents, or server-backed apps
    • Expressive and versatile graphics
    • Large, dynamic or streaming data
    • Easy usage from python (or Scala, or R, or...)

    And most importantly:

    NO JAVASCRIPT REQUIRED

    The goal of Bokeh is to provide elegant, concise construction of novel graphics in the style of D3.js, from the comfort of high level languages such as Python, and to extend this capability with high-performance interactivity over very large or streaming datasets. Bokeh can help anyone who would like to quickly and easily create interactive plots, dashboards, and data applications.

    What can I do with Bokeh

    In [1]:
    # Standard imports 
    
    from bokeh.io import output_notebook, show
    output_notebook()
    
    Loading BokehJS ...
    In [2]:
    # Plot a complex chart with intearctive hover in a few lines of code
    
    from bokeh.models import ColumnDataSource, HoverTool
    from bokeh.plotting import figure
    from bokeh.sampledata.autompg import autompg_clean as df
    from bokeh.transform import factor_cmap
    
    df.cyl = df.cyl.astype(str)
    df.yr = df.yr.astype(str)
    
    group = df.groupby(by=['cyl', 'mfr'])
    source = ColumnDataSource(group)
    
    p = figure(plot_width=800, plot_height=300, title="Mean MPG by # Cylinders and Manufacturer",
               x_range=group, toolbar_location=None, tools="")
    
    p.xgrid.grid_line_color = None
    p.xaxis.axis_label = "Manufacturer grouped by # Cylinders"
    p.xaxis.major_label_orientation = 1.2
    
    index_cmap = factor_cmap('cyl_mfr', palette=['#2b83ba', '#abdda4', '#ffffbf', '#fdae61', '#d7191c'], 
                             factors=sorted(df.cyl.unique()), end=1)
    
    p.vbar(x='cyl_mfr', top='mpg_mean', width=1, source=source,
           line_color="white", fill_color=index_cmap, 
           hover_line_color="darkgrey", hover_fill_color=index_cmap)
    
    p.add_tools(HoverTool(tooltips=[("MPG", "@mpg_mean"), ("Cyl, Mfr", "@cyl_mfr")]))
    
    show(p)
    
    In [3]:
    # Create and deploy interactive data applications
    
    from IPython.display import IFrame
    IFrame('https://demo.bokeh.org/sliders', width=900, height=500)
    
    Out[3]:

    Getting set up

    In [4]:
    from IPython.core.display import Markdown
    Markdown(open("README.md").read())
    
    Out[4]:

    Clone or download the repo

    First get local copies of the tutorial notebooks:

    $ git clone https://github.com/bokeh/bokeh-notebooks.git

    Or download from: https://github.com/bokeh/bokeh-notebooks/archive/master.zip

    Install the dependencies

    This tutorial has been tested on:

    • bokeh 0.12.7
    • pandas 0.20.3
    • notebook 5.0.0
    • phantomjs 2.1.1
    • pillow 4.2.1
    • selenium 3.5.0

    Other combinations may work also.

    The quickest, easiest way to install is to use Anaconda (or Miniconda):

    Installing with anaconda

    Install anaconda

    Anaconda should come with all the dependencies included, but you may need to update your versions.

    Installing with miniconda

    Install miniconda.

    Use the command line to create an environment and install the packages:

    $ conda env create
    $ source activate bokeh-notebooks
    

    NOTE: Run this in the tutorial directory where environment.yml file is.


    Once you've got a base install, you can install the remaining dependencies with:

    conda install phantomjs pillow selenium
    

    Get the sample data

    Bokeh has a sample data download that gives us some data to build demo visualizations. To get it run the following command at your command line:

    $ bokeh sampledata
    

    Install Datashader and Holoviews (optional)

    Some optional sections require the additional packages Flask, Datashader, and Holoviews. These can be installed with:

    $ conda install -c pyviz datashader holoviews flask
    

    Run the Jupyter notebook

    From this folder run jupyter notebook, and open the 00 - Introduction and Setup.ipynb notebook.

    $ jupyter notebook

    Setup-test, run the next cell. Hopefully you should see output that looks something like this:

    IPython - 6.4.0
    Pandas - 0.23.1
    Bokeh - 0.13.0
    
    

    If this isn't working for you, see the README.md in this directory.

    In [5]:
    from IPython import __version__ as ipython_version
    from pandas import __version__ as pandas_version
    from bokeh import __version__ as bokeh_version
    print("IPython - %s" % ipython_version)
    print("Pandas - %s" % pandas_version)
    print("Bokeh - %s" % bokeh_version)
    
    IPython - 7.6.1
    Pandas - 0.24.2
    Bokeh - 1.2.0
    
    In [ ]:
     
    
  • 朝韩将军级会谈时隔11年后在板门店重启 2019-07-23
  • Conférence de presse du Premier ministre chinois 2019-07-09
  • 大观园举办“古琴雅集” 市民感受“古韵端午” 2019-06-30
  • 文脉颂中华——黄河新闻网 2019-06-30
  • 水费欠账竟“穿越”16年?用户质疑:为何没见催缴过? 2019-06-21
  • 买房怎么看风水这个真的实在是太重要了 ——凤凰网房产北京 2019-06-11
  • 6月14日凤凰直通车:茅台再开市场化招聘大门,32个部门要285人葡萄 种植 2019-06-07
  • 习近平为传统文化“代言” 2019-05-27
  • 中巴建交一周年 一系列庆祝活动在巴拿马举行 2019-05-24
  • 招聘启事丨西部网诚聘新媒体编辑记者、实习编辑等人员 2019-05-23
  • A title= href=httpwww.snrtv.comlivech=8 target= 2019-05-23
  • 不止消灭刘海屏 vivo NEX发布会看点汇总 2019-05-22
  • 世相【镜头中的陕西人】 2019-05-20
  • 邓紫棋首任明星制作人 吴亦凡身兼二职 2019-05-20
  • 陶昕然女儿正面照曝光 吃蛋糕萌到爆 2019-05-19
  • 开心假期试玩 英魂之刃手游最强法师 门兴格拉德巴赫vs弗赖堡 排球铁娘子 秒速赛车app 腾讯棋牌充值活动 钻石刮刮乐中奖规则 电子游戏软件编辑去向 快乐双彩网址 大发快三计划表网页 使命召唤ol僵尸模式 三国全面战争为什么跳票 15选5走势图 灰熊vs猛龙 隐密境界的突袭客服 拉齐奥vs乌迪内斯比分预测