8.2 Graphs

Graphs are an integral part of NEURON 3.0's user interface, and are designed to provide plots of simulations which can be printed or incorporated into papers readily with Print & File Window Manager.

A wide selection of choices of graph types may be made available by pressing the "New Graph" button in the mainmenu panel. A sub-menu comes up offering a choice of several common kinds:

The first three axes (Voltage axis, Current axis and State axis) are used to plot variables vs. time. Each of these require their own graph because the method used to solve the cable equations evaluates these variables at different times. For example, voltages are calculated at each time step, but currents are calculated at the half time step before voltage and the state variables are calculated at the half time step after the voltage. For more information on the numerical method used to solve these equations see Hines, 1984.

Graph Type Options

Graph types 1 - 5 are coupled to the standard run procedure so that the value of the function is plotted. (See "Run Control Panel"). "Clicking" on one of the first three choices immediately brings up a graphic window with time as the absissa. The steps in achieving the desired simulation plot are as follows:

1. Selecting a "Voltage" axis from the "New Graph" menu in the NEURON Main Panel opens a new graph window with axes

 	( Y axis: -80 mV to +40 mV;	 X axis: 0 to Tstop )

By default, the voltage in the middle of the currently accessed section is selected to plot: ie, if the soma is the currently accessed section, running the simulation (via the "Init & Run" button in the Control Panel) will produce a plot of the voltage in the middle of the soma vs. time.

2. Selecting " Current axis" from the "New Graph" menu in the NEURON Main Panel opens a new graph window with axes

	(Y axis: -1 to +1nA;	X axis: 0 to Tstop ).

Because there is no default variable for a "Current axis", one must choose one with the "Plot What" option. Running the simulation (via the "Init & Run" button in the Control Panel) will produce a plot of the desired current in the middle of the currently accessed section. For example, the currents available when Hodgkin-Huxley channels have been inserted are ina(0.5), ik(0.5), il_hh(0.5).

3. Selecting " State axis" from the "New Graph" menu in the NEURON Main Panel opens a new graph window for plotting state variables:

	(Y axis: 0 to +1;	X axis: 0 to Tstop ).

Again there is no default variable for state variables, and one must use the "Plot what" option. The states available when Hodgkin-Huxley channels are inserted are m_hh(0.5), h_hh(0.5), and n_hh(0.5).

5. Selecting "Phase plane" opens a graphic window for plotting

	f(t) vs g(t) 

and a dialog box asking for the x axis expression, "t" the default expression. The default vertical axis ranges from 20 to 180 and may bear no relation to that of the variable chosen in the "Plot what" browser. In the example shown in the figure below, "soma.v(.5)" was entered for the X axis; Na & K conductances in the soma were chosen with the "Plot What" browser. When the simulation was run, there was no visible trace of a curve. However when a "View=Plot" option was chosen, the full curves were seen with appropriate X & Y axes.

6. Selecting "Grapher" opens a gemeral purpose panel suited for a variety of uses. For example. it can be used as a batch program in which a parameter is changed incrementally to yield a family of solutions. A trival example is the plotting of an algebraic expression as shown here. In this case, no "generator" was entered. the default axes and independent variable "t" were accepted, and the sine and cosine functions entered in the edit box of the "Plot What" browser.

Another example of the use of grapher is to graph the steady-state values of the m, h, n state variables in the HH equations. These steady-states are calculated for v_init, the initial value of the membrane potential, whenever the procedure init() is called. Thus v_init was entered for the independent variable, init() was entered for the generator; the "set View" graphic window option was used to set the voltage axis to the desired range and the y axis from 0 to 1. The state variables (in the soma) were entered in the "Plot What" browser and the colors changed. Pressing "Plot" then produced the plots shown below.

The "grapher" is also very useful in producing a summary plot of a run of simulations. For example, it is interesting to the peak of the action potential in the soma as a function of the synaptic input condctance on a particular dendrite (as for example in the "Shape Plot" of our simple nerve cell with three dendrites shown above). This is a more complex problem but was solved rather easily by:

  • Choosing as the Independent variable the conductance amplitude of a particular synapse (AlphaSynapse[0].amp). Alternatively one could choose the onset time, tau (the alpha function time constant), or the reversal potential for synaptic currents. The location of the synapse can be viewed and relocated with the "Point Process" Manager" for AlphaSynapse[0].
  • Entering run() for the generator, and
  • Entering vmax in the "Plot What" browser.
  • Adding a new procedure (shown below) to the "simplecell.hoc" program shown in Chapter 7.1 to incorporate the following of the maximum value along with the normal integration carried out by the fadvance() procedure. The procedure advance incorporates the local name "vsoma" which tracks the global name "soma.v(.5)" with each time step carried out by fadvance(). A single "if" statement neatly sets vmax to the vsoma level ,
    • when t=0, it meets the condition of being less than dt
    • OR ( || is the logical OR)
    • when vsoma is greater than vmax

proc advance()	{local vsoma	
	fadvance()	vsoma=soma.v(.5)
	if (t<=dt || vsoma > vmax)	{vmax=vsoma}
	// whenever the "if" condition is met the expression 
	// within the right braces is carried out
}

In another window, the membrane voltage in the axon and soma were plotted as in this figure below which was taken under slightly different conditions of range and number of steps. From this figure it is clear that

  • for synaptic inputs which fail to generate a spike, the voltage in the axon close to the soma is smaller than in the soma but
  • for synaptic inputs which do generate a spike, the reverse is true; the soma lags the adjacent axon in time and amplitude.

    A variety of views of graphs are also available from the "Plot menu" (right mouse button in the plotting field). These are described in detail in Scene & View Options .

    Back to:

    8.1 Simulation Control

    Forward to:

    8.3 Plotting Controls
    8.4 Scene and View Options
    8.5 Sessions