I am trying to set up a jupyter lab on a linux machine and access it locally on my mac.
Following this post I was able to do exactly that. The notebook generally works well, except it cannot plot figures using any sort of interactive backend. If I use %matplotlib widget all figures in the notebook as just a blank plot. With %matplotlib inline the figures plot, but no ability to zoom or anything.
If I try to run
from matplotlib import use
use('TkAgg')
Which is required for one part of my notebook, I get:
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running
I've ensured tkinter is installed, plotly is installed. I tried adding -X to the ssh command (the extent of my ssh knowledge).
Related
I'm trying to set up my JupyterLab environment so that HoloViews loads automatically using the bokeh backend. I've put the following code in my start.py file in the .ipython/profile_default/startup/ directory:
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')
opts.defaults(
opts.Curve(aspect='square'),
opts.Image(colorbar=True, toolbar='above', width=400, aspect='equal')
)
The startup script runs without errors and I can access HoloViews functions in my JupyterLab environment. However, when I try to plot anything (an xarray object for example) using hv.Image() or hv.Curve() I just get a blank output. If I then insert a cell in the JupyterLab notebook and execute hv.extension('bokeh') the plots start showing up when I rerun the plotting commands. They continue to work even if I restart the kernel.
This appears to be an issue specific to the bokeh backend, because if I change the backend to matplotlib (with appropriate modifications to the opts commands), all the plots show up from the start.
Anyone know what's going on here? It would be nice to be able to fully initialize HoloViews with bokeh from the JupyterLab start script.
As the title suggests, I am trying to set my notebook to plot in separate window using the '%matplotlib qt' command. However, when I do I get a 'ModuleNotFoundError' for matplotlib.inline for some reason. I have checked my env using 'pip list' and I have all the modules I need installed (I know this is the case because I have other environments for separate projects where %matplotlib qt works just fine and the module imports are identical.
Hoping for a suggestion that I haven't tried yet. pic of my import cell on current notebook:
The problem seems to occur when I run the % command, even if I just run %matplotlib (without the qt) then I still get the same error. Could this be some sort of a path issue?
EDIT: I will add that if I remove the % command from my notebook I can plot just fine inline, but I don't have the plot tools to zoom in or move around which is the functionality I need to review my data.
I was using matplotlib and found out that there is something as interactive plots in matplotlib via which we can rotate the graph via mouse cursor
%matplotlib qt is used to enable the interactive plots.Works fine in jupyter notebook but google colab shows error enter image description here
Is there any chance it works in google colab also?
No. There is no chance. %matplotlib qtworks only if you have notebook executed on same machine as you use it. Colab is executed on remote server. You may try %matplotlib notebook This create interactive plot inside notebook.
I am working in python and using Anaconda with Spyder and I need to plot a scatter plot in a part of the code I am working on. The plot is just fine but is drawn in the console itself and the size is quite small for my needs.
My question is, how can I plot it in another window outside the ipython console? I already tried changing some of the setting like changing Graphics setting in ipython from inline to QT to tkinter. Nothing seems to work.
Any helpful suggestions?
you can just save %matplotlib qt in a .py file and you can start ipython using:
ipython -i myfile.py
I'm using IPython notebooks to share code and (hopefully) graphics with m collaborators. sadly, I cannot get matplotlib to plot inside the notebook, it always gives me a pop-up window, which I obviously cannot include in notebook pastes or similar.
Here's two minimal examples of how I go about plotting things.
Either with invoking plt.show() , or without it.
this either gives me an external pop-up, or plots nothing.
You need to be using the matplotlib inline backend.
%matplotlib inline