In [1]:
import pymaid
import matplotlib.pyplot as plt
# Connect to CATMAID
rm = pymaid.CatmaidInstance('https://www.your.catmaid-server.org',
api_token='your_token' ,
http_user='user', # omit if not required
http_password='pw')
# Get a neuron
n = pymaid.get_neurons(16)
In [2]:
lh = pymaid.get_volume('LH_R')
in_lh = n.connectors[pymaid.in_volume(n.connectors, lh)]
in_lh.head()
Out[2]:
In [3]:
fig, ax = pymaid.plot2d(n, connectors=True,
linewidth=1.5, method='3d',
cn_size=2)
cn_coords = in_lh[['x','y','z']].values
fig,ax = pymaid.plot2d(cn_coords, method='3d', ax=ax,
scatter_kws={'s': 20,
'color': 'g',
'marker': 'D'
})
ax.dist = 5
plt.show()
In [4]:
# Import plotly bindings
import plotly.offline
# Initialize notebook mode
plotly.offline.init_notebook_mode(connected=True)
In [5]:
# Generate a plotly figure
fig = pymaid.plot3d([cn_coords, n] ,backend='plotly',
connectors=True, width=800,
scatter_kws={'color': (0,255,0), 'opacity': .5})
plotly.offline.iplot(fig)