Reputation: 615
I am running ipython remotely on a remote server. I access it using serveraddress:8888/ etc to write code for my notebooks.
When I use matplotlib of course the plots are inline. Is there any way to remotely send data so that plot window opens up? I want the whole interactive environment on matplotlib on my local machine and all the number crunching on the server machine? This is something very basic....but somehow after rumaging through google for quite a while i can't figure it out.
Upvotes: 3
Views: 3360
Reputation: 87496
The upcoming release (1.4.0, should be out by end of August 2014, release candidates are available) will ship with the nbagg
backend which provides interactive figures with out needing to go to native clients or resorting to using d3. All you need to do in your note book is:
import matplotlib
matplotlib.use('nbagg')
from matplotlib import pyplot as plt
And then to plot
plt.plot(range(3))
plt.show()
If you want to try this now either build from source or look at one of the release candidates.
There are two major difference between using nbagg
and mpld3/bokeh.
First, you don't have interface across library interfaces (or learn js!). My understanding is that both of them create a figure, scrap it (which isn't perfect because mpl was not designed with making this easy in mind). With nbagg mouse and keyboard call backs should work with no translation, I don't think they can currently be exported to d3.
The second is that with nbagg all the rendering happens on the server, with the d3-based libraries all of the data must be naively shipped to the browser (bokeh is working on making this smarter and only shipping you data you can see at a useful resolution). With nbagg
the only thing that comes across the network is png deltas.
Upvotes: 6
Reputation: 23530
There are a few possibilities
If your remote machine is somehow unixish, you may use the X Windows (then your session is on the remote machine and display on the local machine)
mpld3
bokeh
and iPython notebook
nbagg
backend of matplotlib
.¨
Alternative #1 requires you to have an X server on your machine and a connection between the two machines (possibly tunneled through ssh, etc.) So, this is OS dependent, and the performance depends on the connection between the two machines.
Alternatives #2 and #3 are very new but promising. They have quite different approaches, mpl3d
enables the use of standard matplotlib
plotting commands, but with large datasets bokeh
may be more useful.
Alternative #4 is probably the ultimate solution (see tcaswell
's comments), but not yet available without using a development version of matplotlib
(i.e. there may be some installation challenges). On the other hand, if you can hold your breath for a week, 1.4.0 will be out.
Upvotes: 3
Reputation: 529
You want to get the regular (zoomable) plot window, right? I think you can not do it in the same kernel as, unfortunately, you can't switch from inline to qt and such because the backend has already been chosen: your calls to matplotlib.use()
are always before pylab
.
Upvotes: 0