two questions in drawing graph.

The basics of how to develop, test, and use models.
Post Reply
ted
Site Admin
Posts: 6302
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: two questions in drawing graph.

Post by ted »

Dong Xu wrote:1. I used NetWork Builder to build a simple network. and save it to a hoc file.
then I did some addition to the hoc file. How can I get a spike plot and the NetGUI derived from that hoc file?
You can't import the hoc file back into the NetGUI tool.

It's easy to make your own spike plot. In short, use the NetCon class's record() method
to capture the spike times of the cells, plus cell identification numbers, to a pair of Vectors.
Then use the Vector class's mark method to draw | on a graph. Here's how, assuming that all your cells are in a List called cells:

Code: Select all

objref nil, tobj // create a NULLobject objref and a "temporary" objref
objref ncreclist, stvec, idvec // to hold new NetCons, and to record spike times and cell IDs
for i = 0, cells.count()-1 {
  tobj = new NetCon(cells.object(i), nil)
  tobj.record(stvec, idvec, i)
}
objref tobj // so tobj can't be used to do accidental damage

// generate a raster plot
objref g, tmpvec
proc plotspikes() {
  // cell ids start at 0, but we don't want to draw any spikes on the x axis)
  tmpvec = new Vector()
  tmpvec.c(idvec)
  tmpvec.add(1)
  g = new Graph()
  tmpvec.mark(g, stvec, "|")
}

// automate plotting after a run
proc run() {
  stdinit()
  continuerun(tstop)
  plotspikes()
}
Change the name of the List of cells to whatever your program uses, and
load this code after all your other hoc code has been loaded.

Read about NetCon record() here
http://www.neuron.yale.edu/neuron/stati ... tml#record
Read about Vector mark() here
http://www.neuron.yale.edu/neuron/stati ... .html#mark
2. I made a 10*10 matrix, each represents a Intefire1. how can I draw a graph of 10*10 squares using different colors representing M of individual intefire cell?
You want a "Hinton plot"--see
http://www.neuron.yale.edu/neuron/stati ... tml#hinton
You'll need to change the colormap to something that spans the range
0 . . . 1
Post Reply