In [1]:
import pymaid
import matplotlib.pyplot as plt
# Connect to CATMAID
rm = pymaid.CatmaidInstance('https://www.your.catmaid-server.org',
api_token='YOURTOKEN',
http_user='user', # omit if not required
http_password='pw') # omit if not required
# Get two neurons
nl = pymaid.get_neurons(['57311', '27295'])
# Plot using defaults
fig, ax = nl.plot2d()
plt.show()
In [2]:
fig, ax = pymaid.plot2d(nl)
plt.show()
In [3]:
fig, ax = pymaid.plot2d(nl,
color={'57311': 'k', '27295': 'y'},
connectors=False,
linewidth=1.5)
plt.show()
In [4]:
# Reverse order in CatmaidNeuronList
nl_rev = nl[::-1]
fig, ax = pymaid.plot2d(nl_rev,
color={'57311': 'k', '27295': 'y'},
connectors=False,
linewidth=1.5)
plt.show()
In [5]:
# Plot using matplotlib's 2.5D capabilities
fig, ax = nl.plot2d(method='3d',
connectors=False,
linewidth=1.5)
# Change from default frontal view to lateral view by changing the azimuth
ax.azim = 0
# Zoom in a bit
ax.dist = 6
plt.show()
In [6]:
fig, ax = nl.plot2d(method='3d',
connectors=False,
linewidth=1.5)
# Change from default frontal view to top view by changing the elevation
ax.elev = 90
# Zoom in a bit
ax.dist = 6
plt.show()
In [7]:
fig, ax = nl.plot2d(method='3d_complex',
connectors=False,
linewidth=1.5)
for i in range(0,360,5):
# Change rotation
ax.azim = i
# Save each incremental rotation as frame
plt.savefig('_frames/frame_{0}.png'.format(i), dpi=200)
plt.clf()
In [8]:
nl2 = pymaid.get_neurons('annotation:glomerulus DA1')
fig, ax = nl2.plot2d(method='3d_complex',
connectors=False,
linewidth=1.5)
ax.dist = 6
plt.show()
In [9]:
# Retrieve volume
lh = pymaid.get_volume('LH_R')
# Set color and alpha
lh.color = (0, 1, 0, .1)
# Plot
fig, ax = pymaid.plot2d([nl ,lh], method='3d_complex', linewidth=1.5, connectors=False)
ax.dist = 6
plt.show()
In [10]:
# Plot neurons first
fig, ax = nl.plot2d(method='3d_complex', linewidth=1.5, connectors=True)
# Add volume on existing ax
_ = pymaid.plot2d(lh, method='3d_complex', ax=ax)
ax.dist = 6
plt.show()