5 ms·
"Bokeh is a Python interactive visualization library that targets modern web browsers for presentation." A description of how one gets from Python to a web bro
by jbritton 11y ago
"Bokeh is a Python interactive visualization library that targets modern web browsers for presentation."
A description of how one gets from Python to a web browser display would be nice. Is there a translation from Python to Javascript somewhere? Is there a Python web server backend? Are there dynamic visual updates or does this thing just generate a static output like a .png file?
- mfisher87 11y agoFrom the docs, under "Getting started": > When you execute this script, you will see that a new output file "lines.html" is created, and that a browser automatically opens a new tab to display it. (For presentation purposes we have included the plot output directly inline in this document.) This is based on an example calling an output_file() function, but the docs also mention output_notebook(), and I'm sure you can output to HTML as a string as well. I didn't spend too much time digging yet.
- canavandl 11y agoYes - there's the ability to generate the raw html of a plot or a JS script and div that can be embedded in an HTML doc. Source: http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html
- cmdrfred 11y agomy question exactly. What does this do that I can't do with highcharts?
- infinite8s 11y agoThe idea behind bokeh is that you don't need to know JavaScript and can use an api that's familiar to a lot of people coming from matplotlib
- birdsarah 11y agoi would say bokeh is more similar to d3 than highcharts (although my under-standing of highcharts may be off) 1) you can create any viz you want to - you have access to very low-level elements and can build up anything from them 2) it's liberally open source licensed why i initially got sucked into bokeh over d3 is that: a) I prefer python b) I find it more intuitive (d3 always messes with my head)
- birdsarah 11y agoI forgot the really important difference between bokeh and highcharts - you can throw 100k points at it and have it be fully interactive without your browser blowing up!
- mianos 11y agoHiCharts has dynamically loadable data. I have a database that has 120M points. I just keep some pre aggregated data to populate the wide periods. As you zoom it it selects smaller aggregation sets. (Think; 1 month for 10 years, 2 weeks for 1 year, etc). If you have the data you only need about 20 lines of JS so support this with json. That said, bokeh requires little to no javascript and that's a huge advantage if you need to get multiple visualizations. It does, pretty much stock, what you can do with HiCharts without needing as much full-stack expertise.
- pwang 11y agoIn the Dev Guide docs, there is a section about why we built our own Javascript charting library from the ground up: http://bokeh.pydata.org/en/latest/docs/dev_guide/bokehjs.html#bokehjs-motivations http://bokeh.pydata.org/en/latest/docs/dev_guide/bokehjs.htm...
- ced 11y ago> A description of how one gets from Python to a web browser display would be nice. Check out Jupyter notebooks. > Is there a Python web server backend? That's possible for dynamic charts, but for most usage, Bokeh saves all the chart's data inside the .html file (yielding sometimes huge files). See http://bokeh.pydata.org/en/latest/docs/gallery.html http://bokeh.pydata.org/en/latest/docs/gallery.html for examples.
- birdsarah 11y ago> A description of how one gets from Python to a web browser display would be nice http://birdsarah.github.io/europython-2015-bokeh/static/slides.html#/4 http://birdsarah.github.io/europython-2015-bokeh/static/slid... python (or r or scala) spits out json that is consumed by bokehjs
- pwang 11y agoThere is a full-featured javascript runtime "BokehJS" which is designed from the ground up to be driven by remote (aka server-side) models, which are sent over the wire as JSON. The server-side models are generated programmatically via Python, R, Scala, etc. The cool thing is that a lot of the interactivity is completely native in BokehJS, so you can build interactive Javascript visualizations from Python, and have an entirely static HTML document that embeds a lot of rich interactivity. See, for instance, Sarah Bird's excellent GapMinder example: http://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/00%20-%20intro.ipynb#Interaction http://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blo... When you move the slider, it generates JS events which drive model updates completely in the browser, which then update the objects that comprise the plot. All of that is built straight from Python, but there is no Python kernel running in the background. Bokeh also lets you write your event handlers in Python, and reside on the server, and get called back automatically when the user interacts with the plot in some way. Check out this app for example: http://demo.bokehplots.com/apps/selection_histogram http://demo.bokehplots.com/apps/selection_histogram You can use the lasso tool to select some points, and that computes a new sub-histogram. Here is the entirety of the code for it: https://github.com/bokeh/bokeh/blob/master/examples/app/selection_histogram.py https://github.com/bokeh/bokeh/blob/master/examples/app/sele... For more deep-dive on the architecture, you can start at this slide and walk through: http://www.slideshare.net/misterwang/bokeh-tutorial-pydata-strata-san-jose-2015/18 http://www.slideshare.net/misterwang/bokeh-tutorial-pydata-s... Or you can watch this webinar recording (start at the 19 minute mark): https://continuum-analytics.wistia.com/medias/f6wp9dam91 https://continuum-analytics.wistia.com/medias/f6wp9dam91
- asafira 11y agoAre the visualizations downloaded at page load only, or can they be readily fashioned with websockets, etc to turn them into an interactive dashboard? I've been considering running out lab experiments off of a webapp, but haven't found an easy enough solution.
- canavandl 11y agoApart from rendering static html plots or plots with client-side JS callbacks, you could look into using the new bokeh server: http://bokeh.pydata.org/en/latest/docs/user_guide/server.html http://bokeh.pydata.org/en/latest/docs/user_guide/server.htm... It allows for building streaming visualizations or plots with using websockets (implemented using tornado).