Py con india 2016

19
Interactive Date Plotting With Bokeh Kaustuv Deolal

Transcript of Py con india 2016

Page 1: Py con india 2016

Interactive Date Plotting With Bokeh

Kaustuv Deolal

Page 2: Py con india 2016

Bokeh !! Well what is that ?

Page 3: Py con india 2016

Well he would say

Bokeh is a Python interactive visualization library that targets modern web browsers for presentation. Its goal is to provide elegant, concise construction of novel graphics in the style of D3.js, 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.

Page 4: Py con india 2016

In Rancho’s words !

“A pretty amazing plotting library with tons of features”

Page 5: Py con india 2016

Bokeh is simply not confined to Python. It has bindings in different languages. These languages output a Json file which serves as an input for BokehJS , which is a JavaScript library

Since this is PyCon we will be talking about Bokeh Python only !!

Page 6: Py con india 2016
Page 7: Py con india 2016
Page 8: Py con india 2016

Output features

File Notebook Server .Here we show only file

Page 9: Py con india 2016

Plotting with Bokeh

Page 10: Py con india 2016

Charts !!

Page 11: Py con india 2016

Basic Charts Code

Page 12: Py con india 2016

Charts Continued……

Page 13: Py con india 2016
Page 14: Py con india 2016

Bokeh can display plots from other python visualization libraries

Plots from Matplotlib, Seaborn, ggplot can be displayed using Bokeh

bokeh.mpl function is used to display plots from these

to_bokeh() uses bokeh to display Matplotlibfigure.

Page 15: Py con india 2016
Page 16: Py con india 2016

Yes Flask can be integrated with Bokeh

It does make altogether more dynamic

If you have an external web service that you can communicate with to control your data and your app behaviour then you can actually achieve very powerful functionalities

Page 17: Py con india 2016

Bokeh has seamless integration with any web framework. Bokeh Flask is an example for that

The primary issue is not whether or not pixels are painted onto the screen via a web page. For instance, one could write some python code which outputs an HTML file that embeds a Matplotlib PNG image along with a carefully-crafted old-school imagemap via the <map> tag.

The key difference is who the libraries are made for.

D3 requires reasonable knowledge of javascript, and also quite a bit of learning of how the D3 visualization engine itself works. Bokeh, on the other hand, targets users who are interested in writing Python or R or other non-Javascript languages, but who still want interactive graphics in the browser.

Page 18: Py con india 2016

Matplotlib is too much work for creating decent looking graphs. And is too verbose. Graphs can be made more aesthetic with less line of code

Seaborn is another plotting library , but is again based on matplotlib

Pygal can generate interactive plots but is again not customizable

Page 19: Py con india 2016