Magpy inline plots in jupyter
Closed this issue · 2 comments
Ensase commented
Hi everyone!
I've tried to plot loaded streams inside jupyter notebook:
%matplotlib inline
from magpy.stream import read
import magpy.mpplot as mp
stream = read(r'~/data/*.min')
mp.plot(stream)
The dedicated conda env with python 3.7 and magpy 1.0.3 used to run this code.
I've got the error:
[/opt/anaconda3/envs/magpy1/lib/python3.7/site-packages/magpy/stream.py:1590](): VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
return DataStream(self,self.header,np.asarray(array))
[/opt/anaconda3/envs/magpy1/lib/python3.7/site-packages/magpy/mpplot.py:2480](): UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
plt.show()
Could you suggest me how to use inline plots with magpy?
leonro commented
You might try to add the following line in order to use a different backend:
%matplotlib inline
from magpy.stream import read
import magpy.mpplot as mp
matplotlib.use('TkAgg')
stream = read(r'~/data/*.min')
mp.plot(stream)
There are other supported backends as well like WXAgg, Qt5Agg...
leonro commented
Closing this now as the solution posted in February seems to be satisfying