## How to plot a variable vs. distance

A collection of noteworthy items selected by our moderators from discussions about making and using models with NEURON.

Moderators: wwlytton, tom_morse, ted

ted
Posts: 5891
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### How to plot a variable vs. distance

Thanks to mingu31 for asking the question that led to this answer.

In NEURON, a variable that can have different values at different locations in space is called a range variable. Range variables can be plotted as a function of distance along a path. Such plots are called space plots. Space plots can be created with hoc code or with the GUI.

To create a space plot with the GUI, click on
NEURON Main Menu / Graph / Shape plot
Click on the menu box (in upper left corner of the Shape plot's canvas) and select "Space Plot" from the menu.
Place cursor next to one end of the path that you are interested in.
Press left button on mouse and hold down while dragging cursor over the path of interest.
Release mouse button.

After you have set up all the paths you want, close the Shape plot window.
The Space Plot window will persist.

Use Movie Run to see the Space Plot evolve smoothly in time.
NEURON Main Menu / Tools / Movie Run
Launch simulations by clicking on the Movie Run tool's Init & Run button.

Hints:
1. You can add multiple paths to a single space plot, but one or two is usually enough.
2. By default a Space Plot shows voltage along a path, but any other range variable can be plotted. To specify which range variable will be plotted, use the Shape plot's "Plot what?" tool.
Click on the Shape plot's menu box and select Plot what? from the menu.
Click in the white "edit field" and type the name of the range variable.
For example, if your model is neurondemo's pyramidal cell, you might want to see a plot of i_cap (membrane capacitive current).
Click the Accept button, and the label on the Shape plot will change from v to the name of the range variable you entered.
Now you can create a Space Plot as described above. Try a path that runs from the most distal apical branch termination (upper left in the shape plot) to the distal end of the axon (lower right).