{"id":1095,"date":"2017-03-25T00:27:29","date_gmt":"2017-03-25T00:27:29","guid":{"rendered":"http:\/\/intelligentonlinetools.com\/blog\/?p=1095"},"modified":"2017-04-09T01:20:23","modified_gmt":"2017-04-09T01:20:23","slug":"3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library","status":"publish","type":"post","link":"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/","title":{"rendered":"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library"},"content":{"rendered":"<p>Bokeh is a Python  library for building advanced and modern data visualization web applications.   Bokeh allows to add interactive controls like slider, buttons, dropdown menu and so on to the data graphs. Bokeh provides a variety of ways to embed plots and data into HTML documents including generating standalone HTML documents. [6]  <\/p>\n<p>There is a sharp increase of popularity for Bokeh data visualization libraries (Fig 1), reflecting the increased interest in machine learning and data science over the last few years.<\/p>\n<figure id=\"attachment_1115\" aria-describedby=\"caption-attachment-1115\" style=\"width: 290px\" class=\"wp-caption alignnone\"><img data-attachment-id=\"1115\" data-permalink=\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/bokeh-and-other-data-viz\/#main\" data-orig-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh-and-other-data-viz.png\" data-orig-size=\"1725,793\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"bokeh and other data viz\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Trend for Bokeh and Other Data Visualizations Libraries.  Source: Google Trends&lt;\/p&gt;\n\" data-medium-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh-and-other-data-viz-300x138.png\" data-large-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh-and-other-data-viz-1024x471.png\" decoding=\"async\" loading=\"lazy\" src=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh-and-other-data-viz-300x138.png\" alt=\"\" width=\"600\" height=\"278\" class=\"size-medium wp-image-1115\" \/><figcaption id=\"caption-attachment-1115\" class=\"wp-caption-text\">Fig 1. Trend for Bokeh and Other Data Visualizations Libraries.  Source: Google Trends<\/figcaption><\/figure>\n<p>In this post we put together 4 most common examples of data plots using Bokeh. The examples include such popular controls like slider, button. They use loading data from data files which is common situation in practice. The examples show how to add create plot and how to add interactivity using Bokeh and will help to make quick start in using Bokeh.<\/p>\n<p>Our first example demonstrates how to add interactivity with <strong>slide<\/strong> control. This example is taken from Bokeh documentation [4]. When we change the slider value the line is changing its properties. See Fig 2 for example how the plot is changing.  The example is using callbak function attached to slider control. <\/p>\n<pre><code>\r\n# -*- coding: utf-8 -*-\r\n\r\nfrom bokeh.layouts import column\r\nfrom bokeh.models import CustomJS, ColumnDataSource, Slider\r\nfrom bokeh.plotting import Figure, output_file, show\r\n\r\n# fetch and clear the document\r\nfrom bokeh.io import curdoc\r\ncurdoc().clear()\r\n\r\noutput_file(\"callback.html\")\r\n\r\nx = [x*0.005 for x in range(0, 200)]\r\ny = x\r\n\r\nsource = ColumnDataSource(data=dict(x=x, y=y))\r\n\r\nplot = Figure(plot_width=400, plot_height=400)\r\nplot.line('x', 'y', source=source, line_width=3, line_alpha=0.6)\r\n\r\ndef callback(source=source, window=None):\r\n    data = source.data\r\n    f = cb_obj.value\r\n    x, y = data['x'], data['y']\r\n    for i in range(len(x)):\r\n        y[i] = window.Math.pow(x[i], f)\r\n    source.trigger('change')\r\n\r\nslider = Slider(start=0.1, end=4, value=1, step=.1, title=\"power\",\r\n                callback=CustomJS.from_py_func(callback))\r\n\r\nlayout = column(slider, plot)\r\n\r\nshow(layout)\r\n<\/code><\/pre>\n<p>Alternatively we can attach callback through the js_on_change method of Bokeh slider model: <\/p>\n<pre><code>\r\ncallback = CustomJS(args=dict(source=source), code=\"\"\"\r\n    var data = source.data;\r\n    var f = cb_obj.value\r\n    x = data['x']\r\n    y = data['y']\r\n    for (i = 0; i < x.length; i++) {\r\n        y[i] = Math.pow(x[i], f)\r\n    }\r\n    source.trigger('change');\r\n\"\"\")\r\n\r\nslider = Slider(start=0.1, end=4, value=1, step=.1, title=\"power\")\r\nslider.js_on_change('value', callback)\r\n<\/code><\/pre>\n<figure id=\"attachment_1117\" aria-describedby=\"caption-attachment-1117\" style=\"width: 290px\" class=\"wp-caption alignnone\"><img data-attachment-id=\"1117\" data-permalink=\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/bokeh1_1\/#main\" data-orig-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_1.png\" data-orig-size=\"729,682\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"bokeh1_1\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Data plot from data file 1&lt;\/p&gt;\n\" data-medium-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_1-300x281.png\" data-large-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_1.png\" decoding=\"async\" loading=\"lazy\" src=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_1-300x281.png\" alt=\"\" width=\"300\" height=\"281\" class=\"size-medium wp-image-1117\" srcset=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_1-300x281.png 300w, http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_1.png 729w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-1117\" class=\"wp-caption-text\">Fig 2A. Initial Data plot<\/figcaption><\/figure>\n<figure id=\"attachment_1119\" aria-describedby=\"caption-attachment-1119\" style=\"width: 290px\" class=\"wp-caption alignnone\"><img data-attachment-id=\"1119\" data-permalink=\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/bokeh1_2\/#main\" data-orig-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_2.png\" data-orig-size=\"691,679\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"bokeh1_2\" data-image-description=\"\" data-image-caption=\"&lt;p&gt;Data plot for example 1&lt;\/p&gt;\n\" data-medium-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_2-300x295.png\" data-large-file=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_2.png\" decoding=\"async\" loading=\"lazy\" src=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_2-300x295.png\" alt=\"\" width=\"300\" height=\"295\" class=\"size-medium wp-image-1119\" srcset=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_2-300x295.png 300w, http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh1_2.png 691w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-1119\" class=\"wp-caption-text\">Fig 2B. Data plot after changed slider position<\/figcaption><\/figure>\n<p>Our second example shows how to use <strong>button<\/strong> control. In this example we use Button on_click method to change graph.  <\/p>\n<pre><code>\r\n# -*- coding: utf-8 -*-\r\n\r\nfrom bokeh.layouts import column\r\nfrom bokeh.models import CustomJS, ColumnDataSource\r\nfrom bokeh.plotting import Figure, output_file, show\r\n\r\nfrom bokeh.io import curdoc\r\ncurdoc().clear()\r\n\r\nfrom bokeh.models.widgets import Button\r\noutput_file(\"button.html\")\r\n\r\n\r\nx = [x*0.05 for x in range(0, 200)]\r\ny = x\r\n\r\nsource = ColumnDataSource(data=dict(x=x, y=y))\r\n\r\nplot = Figure(plot_width=400, plot_height=400)\r\nplot.line('x', 'y', source=source, line_width=3, line_alpha=0.6)\r\n\r\ncallback = CustomJS(args=dict(source=source), code=\"\"\"\r\n    var data = source.data;\r\n    x = data['x']\r\n    y = data['y']\r\n    for (i = 0; i < x.length; i++) {\r\n        y[i] = Math.pow(x[i], 4)\r\n    }\r\n    source.trigger('change');\r\n\"\"\")\r\n\r\n\r\ntoggle1 = Button(label=\"Change Graph\", callback=callback, name=\"1\")\r\nlayout = column(toggle1 , plot)\r\n\r\nshow(layout)\r\n<\/code><\/pre>\n<p>Our 3rd example demonstrates how to <strong>load data from csv data file<\/strong>. This example is borrowed from stackoverflow [5] In this example we also use button, but here we load data from file to dataframe. We use two buttons, two files and 2 dataframes, the buttons allow to switch between data files and reload the graph.<\/p>\n<pre><code>\r\n# -*- coding: utf-8 -*-\r\nfrom bokeh.io import vplot\r\nimport pandas as pd\r\nfrom bokeh.models import CustomJS, ColumnDataSource\r\nfrom bokeh.models.widgets import Button\r\nfrom bokeh.plotting import figure, output_file, show\r\n\r\noutput_file(\"load_data_buttons.html\")\r\n\r\ndf1 = pd.read_csv(\"data_file_1.csv\")\r\ndf2 = pd.read_csv(\"data_file_2.csv\")\r\n\r\ndf1.columns = df1.columns.str.strip()\r\ndf2.columns = df2.columns.str.strip()\r\nplot = figure(plot_width=400, plot_height=400, title=\"xxx\")\r\nsource = ColumnDataSource(data=dict(x=[0, 1], y=[0, 1]))\r\nsource2 = ColumnDataSource(data=dict(x1=df1.x.values, y1=df1.y.values, \r\n                                    x2=df2.x.values, y2=df2.y.values))\r\n\r\nplot.line('x', 'y', source=source, line_width=3, line_alpha=0.6)\r\n\r\ncallback = CustomJS(args=dict(source=source, source2=source2), code=\"\"\"\r\n        var data = source.get('data');\r\n        var data2 = source2.get('data');\r\n        data['x'] = data2['x' + cb_obj.get(\"name\")];\r\n        data['y'] = data2['y' + cb_obj.get(\"name\")];\r\n        source.trigger('change');\r\n    \"\"\")\r\n\r\ntoggle1 = Button(label=\"Load data file 1\", callback=callback, name=\"1\")\r\ntoggle2 = Button(label=\"Load data file 2\", callback=callback, name=\"2\")\r\n\r\nlayout = vplot(toggle1, toggle2, plot)\r\n\r\nshow(layout)\r\n<\/code><\/pre>\n<p>As mentioned on the web, Interactive data visualizations turn plots into powerful interfaces for data exploration. [7]  The shown above examples demonstrate how to make the graph data interactive and hope will help to make quick start in this direction.<\/p>\n<p><strong>References<\/strong><br \/>\n1. <a href=https:\/\/blog.modeanalytics.com\/python-interactive-plot-libraries\/ target=\"_blank\">5 Python Libraries for Creating Interactive Plots<\/a><br \/>\n2. <a href=https:\/\/blog.modeanalytics.com\/python-data-visualization-libraries\/ target=\"_blank\">10 Useful Python Data Visualization Libraries for Any Discipline<\/a><br \/>\n3. <a href=http:\/\/www.kdnuggets.com\/2017\/01\/most-popular-language-machine-learning-data-science.html target=\"_blank\">The Most Popular Language For Machine Learning and Data Science<\/a><br \/>\n4. <a href=http:\/\/bokeh.pydata.org\/en\/latest\/ target=\"_blank\">Welcome to Bokeh<\/a><br \/>\n5. <a href=http:\/\/stackoverflow.com\/questions\/34680708\/load-graph-data-from-files-on-button-click-with-bokeh target=\"_blank\">Load graph data from files on button click with bokeh<\/a><br \/>\n6. <a href=http:\/\/bokeh.pydata.org\/en\/latest\/docs\/user_guide\/embed.html target=\"_blank\">Embedding Plots and Apps<\/a><br \/>\n7. <a href=https:\/\/bioengineering.stanford.edu\/news\/how-effective-data-visualizations-let-users-have-conversation-data target=\"_blank\">How effective data visualizations let users have a conversation with data<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bokeh is a Python library for building advanced and modern data visualization web applications. Bokeh allows to add interactive controls like slider, buttons, dropdown menu and so on to the data graphs. Bokeh provides a variety of ways to embed plots and data into HTML documents including generating standalone HTML documents. [6] There is a &#8230; <a title=\"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library\" class=\"read-more\" href=\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[6,9,10],"tags":[],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library - Machine Learning Applications<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library - Machine Learning Applications\" \/>\n<meta property=\"og:description\" content=\"Bokeh is a Python library for building advanced and modern data visualization web applications. Bokeh allows to add interactive controls like slider, buttons, dropdown menu and so on to the data graphs. Bokeh provides a variety of ways to embed plots and data into HTML documents including generating standalone HTML documents. [6] There is a ... Read more\" \/>\n<meta property=\"og:url\" content=\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/\" \/>\n<meta property=\"og:site_name\" content=\"Machine Learning Applications\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-25T00:27:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-09T01:20:23+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh-and-other-data-viz-300x138.png\" \/>\n<meta name=\"author\" content=\"owygs156\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"owygs156\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/\",\"url\":\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/\",\"name\":\"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library - Machine Learning Applications\",\"isPartOf\":{\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#website\"},\"datePublished\":\"2017-03-25T00:27:29+00:00\",\"dateModified\":\"2017-04-09T01:20:23+00:00\",\"author\":{\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478\"},\"breadcrumb\":{\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/intelligentonlinetools.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#website\",\"url\":\"http:\/\/intelligentonlinetools.com\/blog\/\",\"name\":\"Machine Learning Applications\",\"description\":\"Artificial intelligence, data mining and machine learning for building web based tools and services.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/intelligentonlinetools.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478\",\"name\":\"owygs156\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g\",\"caption\":\"owygs156\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library - Machine Learning Applications","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/","og_locale":"en_US","og_type":"article","og_title":"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library - Machine Learning Applications","og_description":"Bokeh is a Python library for building advanced and modern data visualization web applications. Bokeh allows to add interactive controls like slider, buttons, dropdown menu and so on to the data graphs. Bokeh provides a variety of ways to embed plots and data into HTML documents including generating standalone HTML documents. [6] There is a ... Read more","og_url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/","og_site_name":"Machine Learning Applications","article_published_time":"2017-03-25T00:27:29+00:00","article_modified_time":"2017-04-09T01:20:23+00:00","og_image":[{"url":"http:\/\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/03\/bokeh-and-other-data-viz-300x138.png"}],"author":"owygs156","twitter_card":"summary_large_image","twitter_misc":{"Written by":"owygs156","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/","url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/","name":"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library - Machine Learning Applications","isPartOf":{"@id":"http:\/\/intelligentonlinetools.com\/blog\/#website"},"datePublished":"2017-03-25T00:27:29+00:00","dateModified":"2017-04-09T01:20:23+00:00","author":{"@id":"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478"},"breadcrumb":{"@id":"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/intelligentonlinetools.com\/blog\/2017\/03\/25\/3-most-useful-examples-to-add-interactivity-to-graph-data-using-bokeh-library\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/intelligentonlinetools.com\/blog\/"},{"@type":"ListItem","position":2,"name":"3 Most Useful Examples to Add Interactivity to Graph Data Using Bokeh Library"}]},{"@type":"WebSite","@id":"http:\/\/intelligentonlinetools.com\/blog\/#website","url":"http:\/\/intelligentonlinetools.com\/blog\/","name":"Machine Learning Applications","description":"Artificial intelligence, data mining and machine learning for building web based tools and services.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/intelligentonlinetools.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478","name":"owygs156","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/image\/","url":"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g","caption":"owygs156"}}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7h1IJ-hF","jetpack-related-posts":[{"id":852,"url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/01\/22\/data-visualization-visualizing-an-lda-model-using-python\/","url_meta":{"origin":1095,"position":0},"title":"Data Visualization &#8211; Visualizing an LDA Model using Python","date":"January 22, 2017","format":false,"excerpt":"In the previous post Topic Extraction from Blog Posts with LSI , LDA and Python python code was created for text documents topic modeling using Latent Dirichlet allocation (LDA) method. The output was just an overview of the words with corresponding probability distribution for each topic and it was hard\u2026","rel":"","context":"In &quot;Data Mining&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/01\/word_topic_dataframe-300x112.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1385,"url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/10\/15\/scraping\/","url_meta":{"origin":1095,"position":1},"title":"Combining Machine Learning and Data Scraping","date":"October 15, 2017","format":false,"excerpt":"I often come across web posts about extracting data (data scraping) from websites. For example recently in [1] Scrapy tool was used for web scraping with Python. Once we get scraping data we can use extracted information in many different ways. As computer algorithms evolve and can do more, the\u2026","rel":"","context":"In &quot;Data Mining&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1422,"url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/11\/02\/data-visualization-of-word-correlations-with-networkx\/","url_meta":{"origin":1095,"position":2},"title":"Data Visualization of Word Correlations with NetworkX","date":"November 2, 2017","format":false,"excerpt":"This is a continuation of my previous post, found here Combining Machine Learning and Data Scraping. Data visualization is added to show correlations between words. The graph was built using NetworkX python library. The input for the graph is the array corr_data with 3 columns : pair of words and\u2026","rel":"","context":"In &quot;Data Mining&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/11\/NetworkX_graph-300x211.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":966,"url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/02\/18\/building-decision-trees-in-python\/","url_meta":{"origin":1095,"position":3},"title":"Building Decision Trees in Python","date":"February 18, 2017","format":false,"excerpt":"A decision tree is a decision support tool that uses a tree-like graph or model of decisions and their possible consequences, including chance event outcomes, resource costs, and utility. It is one way to display an algorithm. Decision trees are commonly used in operations research, specifically in decision analysis, to\u2026","rel":"","context":"In &quot;Artificial Intelligence&quot;","img":{"alt_text":"Decision Tree","src":"https:\/\/i0.wp.com\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2017\/02\/dt_post1_N_CTQ_Cost_regr1-2-use-this-300x103.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1857,"url":"http:\/\/intelligentonlinetools.com\/blog\/2018\/02\/10\/how-to-create-data-visualization-for-association-rules-in-data-mining\/","url_meta":{"origin":1095,"position":4},"title":"How to Create Data Visualization for Association Rules in Data Mining","date":"February 10, 2018","format":false,"excerpt":"Association rule learning is used in machine learning for discovering interesting relations between variables. Apriori algorithm is a popular algorithm for association rules mining and extracting frequent itemsets with applications in association rule learning. It has been designed to operate on databases containing transactions, such as purchases by customers of\u2026","rel":"","context":"In &quot;Data Mining&quot;","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2018\/02\/association_rules_scatter_plot_for_retailer_dataset.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":256,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/06\/05\/using-python-for-mining-data-from-twitter-visualization-and-other-enchancements\/","url_meta":{"origin":1095,"position":5},"title":"Using Python for Data Visualization of Clustering Results","date":"June 5, 2016","format":false,"excerpt":"In one of the previous post http:\/\/intelligentonlinetools.com\/blog\/2016\/05\/28\/using-python-for-mining-data-from-twitter\/ python source code for mining Twitter data was implemented. Clustering was applied to put tweets in different groups using bag of words representation for the text. The results of clustering were obtained via numerical matrix. Now we will look at visualization of clustering\u2026","rel":"","context":"In &quot;Artificial Intelligence&quot;","img":{"alt_text":"Data Visualization for Clustering Results","src":"https:\/\/i0.wp.com\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/06\/data-visualization1-300x220.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/1095"}],"collection":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/comments?post=1095"}],"version-history":[{"count":27,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/1095\/revisions"}],"predecessor-version":[{"id":1099,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/1095\/revisions\/1099"}],"wp:attachment":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/media?parent=1095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/categories?post=1095"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/tags?post=1095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}