5 ms·
As a "database guy" who uses Python for most things not bash, is this an approach for viz apps that would eliminate (most) of the need to muck about in JavaScri
by bsg75 13y ago
As a "database guy" who uses Python for most things not bash, is this an approach for viz apps that would eliminate (most) of the need to muck about in JavaScript?
D3 and its children produce some awesome visualizations, but the bandwidth does not exist for me to begin developing apps in a language I don't have much experience in.
If something like Bokeh allows me to live mostly in Python, it becomes even more interesting.
- paddy_m 13y agoThat is exactly the point of bokeh. It allows you to write python code and get browser based plots. Currently we have a python interface, but we intend to build interfaces in other langauges. Look at the examples gallery, which include the code needed to generate the plots. http://bokeh.pydata.org/gallery.html http://bokeh.pydata.org/gallery.html A relatively simple plot (scroll down to see the code): http://bokeh.pydata.org/plot_gallery/correlation.html http://bokeh.pydata.org/plot_gallery/correlation.html The simplest example plot in the repo: https://github.com/ContinuumIO/bokeh/blob/master/examples/plotting/file/line.py https://github.com/ContinuumIO/bokeh/blob/master/examples/pl...
- Dartanion7 13y agoThis is really cool, but what about adding interactivity with the charts? My first thought when I saw the headline was that this python library just generates D3 code, but it seems to be generating some sort of a static SVG object.
- hhuuggoo 13y agoWe're actually using canvas. http://bokeh.pydata.org/plot_gallery/iris.html http://bokeh.pydata.org/plot_gallery/iris.html That has a selection tool you can play around with.
- bigreddot 13y agoThere are already some tools available, pan and wheel zoom, plot resizing, selection (on some plot types). Many more tool types are planned. As for the architecture, BokehJS is built entirely on top of HTML canvas. The python bokeh library sends data and plot specifications to the browser, which uses BokehJS to render the plot and handle interactive tools, etc.
- Dartanion7 13y agoGotcha, thanks.
- paddy_m 13y agoHere is a linked brushing example in the IPython notebook. http://nbviewer.ipython.org/urls/raw.github.com/ContinuumIO/bokeh/master/examples/plotting/notebook/linked_brushing.ipynb http://nbviewer.ipython.org/urls/raw.github.com/ContinuumIO/...
- primelens 13y agoFor some reason I can't get any of the interactivity buttons to work. EDIT: Ok, everything but the zoom works. How do you zoom?
- bigreddot 13y agoThe current zoom tool is a scroll wheel zoom, not a box selection zoom. Guessing that might be the issue since others have run into the ambiguous description as well. It will be labeled more precisely in master in a few days and in the next release as well. If that is not the issue, please file a ticket on GitHub!
- primelens 13y agoOn a Macbook, the scroll wheel equivalent is the two fingered scroll and that doesn't seem to work for me (scroll the page).
- bigreddot 13y agoDo you have the tool selected in the toolbar above? If so, please file a ticket on GH about this. Most of the Bokeh devs are on OSX so it would surprise me if it does not work on OSX, but if there is a bug we want to fix it!
- est 13y agoHope there's some kind of python server side push technology to update browser graphs in realtime.
- pwang 13y agoYes: http://continuum.io/blog/painless_streaming_plots_w_bokeh http://continuum.io/blog/painless_streaming_plots_w_bokeh
- paddy_m 13y agoTo be more clear, there are two main parts of bokeh. First there is the js portion which uses canvas to create the plots. There is an object model that allows plots to be composed of multiple components (glyphs, data sources, axes, data ranges). The python side produces json that represents the objects to be plotted. Python only writes a small amount of js to start the js running. For the most part python just produces json objects that the js side reads. There could be alternate implementations of the python side that still use the same js rendering logic. You could even write a nicer higher-level js api that wraps the low-level component construction. I talked about this at PyData NYC. Here is my notebook (which I am in the process of updating for bokeh 0.3) http://nbviewer.ipython.org/urls/raw.github.com/paddymul/bokeh_tutorial/master/bokeh_tutorial.ipynb http://nbviewer.ipython.org/urls/raw.github.com/paddymul/bok...
- jparmer 13y agoIf you're looking to make scientific D3 graphs with Python, never touching anything close to javascript, you can also check out the Plotly Python API: https://plot.ly/api/python https://plot.ly/api/python It was designed foremost to make graphs pertinent for scientific and engineering applications: https://plot.ly/~alex/76/ https://plot.ly/~alex/76/ (Disclosure: I'm a dev @Plotly)
- gammarator 13y agoTake a look at Vincent, which may give you what you're looking for (Python -> Vega, a d3 wrapper): https://vincent.readthedocs.org/en/latest/ https://vincent.readthedocs.org/en/latest/