We show you how to visualise the data you are working with
!pip install vfb-connect --upgrade
# Import libs and initialise API objects
from vfb_connect.cross_server_tools import VfbConnect
import pandas as pd

vc = VfbConnect()  

import pymaid
import navis

# Needed because deepnote doesn't support fancy progress bars yet

# Connect to the VFB CATMAID server hosting the FAFB data
rm = pymaid.connect_catmaid(server="",  
                            api_token=None, max_threads=10)

# Test call to see if connection works 
print(f'Server is running CATMAID version {rm.catmaid_version}')
WARNING: Could not load OpenGL library.
INFO  : Global CATMAID instance set. Caching is ON. (pymaid)
Server is running CATMAID version 2020.02.15-905-g93a969b37


navis lets you plot neurons in 2d using matplotlib (nice for figures), and in 3d using either plotly when in a notebook environment like Deepnote or using a vispy-based 3D viewer when using a Python terminal. The vispy solution won’t work in Deepnote so we will focus on matplotlib’s 2d and plotly for 3d.

# We'll use a FAFB neuron, retrieved using navis as an example
n = pymaid.get_neurons(16) # retrieves a CatMaid neuron object with skeleton id = 16 (See the Mapping notebook for how to find )
INFO  : Cached data used. Use `pymaid.clear_cache()` to clear. (pymaid)
INFO  : Cached data used. Use `pymaid.clear_cache()` to clear. (pymaid)

type CatmaidNeuron
name Uniglomerular mALT VA6 adPN 017 DB
id 16
n_nodes 16840
n_connectors 2158
n_branches 1172
n_leafs 1230
cable_length 4003103.232861
soma [2941309]
units 1 nanometer
# We can plot this in 2D

(<Figure size 432x432 with 1 Axes>, <Axes3DSubplot:>)


# Or 3D


  • left click and drag to rotate (select “Orbital rotation” above the legend to make your life easier)
  • mousewheel to zoom
  • middle-mouse + drag to translate
  • click legend items (single or double) to hide/unhide


The above plots are very basic examples but there are a ton of ways to tweak things to your liking. For a full list of parameters check out the docs for plot2d and plot3d. (Hint - you can view documentation by floating over a method name in Deepnote)

Let’s for example change the colors. In general, colors can be:

a string - e.g. “red” or just “r” an rgb/rgba tuple - e.g. (1, 0, 0) for red

navis.plot3d(n, color='red')