-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for bokeh (Python) or Gadfly (Julia)? #65
Comments
Bokeh relies on the execution of javascript in the web browser - something that Emacs is not capable of, to my knowledge. That also means that widgets will probably never work in EIN. A possible solution/workaround might be to have ein open a web page in these cases.. |
unless the xwidgets branch ever gets merged http://labs.it-huset.se/jenkins/job/Emacs/ |
I would also be very interested in working with bokeh from EIN and, more generally, visualizations that need to execute in Javascript in a browser. As I understand it, the latest emacs versions do support xwidgets, if you compile it appropriately. Unfortunately, I've not found an OSX build that is xwidgets enabled and I expect the build process to be quite painful (I expect it would be quited easy on linux!). Another approach is discussed in the original EIN repo here. In short, the idea is to use skewer-mode which seems like a more maintainable/sensible approach to me. In fact, this is something @millejoh already prototyped in this repo on this this branch. What is the status of that prototype? If it was promising and just needs a bit more work, I might be able contribute - I am using notebooks constantly (which need web rendering) and working with code outside emacs is becoming intolerable! |
Using skewer-mode did actually work, in that one could execute arbitrary Javascript expressions and getting output into the notebook. The problem comes when the Javascript tries to manipulate/access the DOM, which I believe is what happens with IPython widgets and many notebook extensions. Getting a bokeh interactive graph embedded in an EIN notebook is not something that I see as possible at this point. My one hope is that with skewer-mode the javascript runs in the browser, so if one is clever in outputting the right HTML to, say, simulate an ipython output cell before running any javascript then at least one could get the bokeh graph running in a browser tab. @jlstevens I am always happy to have contributions! If you have any questions on the code don't hesitate to ask. |
I asked a core bokeh dev about DOM manipulation and bokeh only manipulates things under one div which it creates as part of the HTML output. I don't know enough about skewer mode just yet but why would DOM manipulation be an issue once the HTML/JS has been sent to the browser? |
I now realize you meant getting it to display within emacs. As lovely as that would be, I agree this isn't going to be possible any time soon.
That would be the idea! I have finally had a chance to play around with this. I did manage to get a bokeh plot to update via skewer mode. First I had to make sure all Javascript was referenced as .js files in script tags - any inline scripting messed up skewers ability to evaluate HTML. This meant that the body (ignoring the scripts in the header) looked like: <body>
<div style='display: table; margin: 0 auto;'>
<div class="bk-root">
<div class="bk-plotdiv" id="1adf03d2-0c1d-4469-9287-8632d6417a00"></div>
</div>
<script src="http://localhost:8000/plot.js"></script>
</div>
</body> where Then I could update the plot by fiddling with the JSON values in
Everything continued to work if I replaced the id More importantly, I was able to generate an entirely different type of bokeh plot and update to it, by completely replacing It looks to me like there could be a path forward, serving the appropriate For instance, how would running a cell that would output a bokeh plot (in the normal notebook environment) update the plot shown in the browser via skewer? Would there be a shortcut for the user to hit or does EIN have the equivalent of display hooks that could do this automatically? |
EIN has no plans to support widgets until webkit integrates with emacs (unlikely to happen in the medium term). |
I was wondering what the support for interactive plotting like bokeh in Python or Gadfly in Julia would look like? This would be really interesting for interactive plotting.
The text was updated successfully, but these errors were encountered: