Py con india 2016
-
Upload
kaustuv-deolal -
Category
Technology
-
view
147 -
download
0
Transcript of Py con india 2016
![Page 1: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/1.jpg)
Interactive Date Plotting With Bokeh
Kaustuv Deolal
![Page 2: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/2.jpg)
Bokeh !! Well what is that ?
![Page 3: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/3.jpg)
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](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/4.jpg)
In Rancho’s words !
“A pretty amazing plotting library with tons of features”
![Page 5: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/5.jpg)
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](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/6.jpg)
![Page 7: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/7.jpg)
![Page 8: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/8.jpg)
Output features
File Notebook Server .Here we show only file
![Page 9: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/9.jpg)
Plotting with Bokeh
![Page 10: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/10.jpg)
Charts !!
![Page 11: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/11.jpg)
Basic Charts Code
![Page 12: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/12.jpg)
Charts Continued……
![Page 13: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/13.jpg)
![Page 14: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/14.jpg)
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](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/15.jpg)
![Page 16: Py con india 2016](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/16.jpg)
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](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/17.jpg)
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](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/18.jpg)
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](https://reader033.fdocuments.us/reader033/viewer/2022051521/58ee3b5c1a28abbb5b8b46d7/html5/thumbnails/19.jpg)