Page 1 of 1

Shape shape plot in hoc

Posted: Thu Apr 11, 2013 2:09 pm
by adamimos
Hi all,

I'm trying to do something in hoc that is quite simple to do with the GUI (I'm sure it's also simple in hoc, I'm just at a loss for trying to figure out how to do it). I just want to open a simple shape plot that is color coded by a variable (e.g. the voltage "v"). I've looked through the PlotShape() documentation to no avail so far. Here's what i've tried:

Code: Select all

objref g2
g2 = new PlotShape()

I've also tried setting the colorbar and the scale, but no colors ever show up, only a pretty diagram of the neuron.


Re: Shape shape plot in hoc

Posted: Thu Apr 11, 2013 2:13 pm
by adamimos
I've noticed that if I manually go to the figure and select Variable Scale > Shape, I then get what I want. I am essentially asking for the hoc code that does this.


Re: Shape shape plot in hoc

Posted: Thu Apr 11, 2013 11:07 pm
by adamimos
just found this answer from ted from another post that solves the issue:
Every graph class has a method called exec_menu. Read about it here ... #exec_menu
The key is to know the name of the graph, or of the objref that points to the graph.
If you created a graph via hoc code like
objref foo
foo = Graph()
foo = Shape()
foo = PlotShape()
foo.exec_menu("Keep Lines")
is equivalent to clicking on the Keep Lines item in the graph menu.

If instead you created a graph by using the NEURON Main Menu toolbar, there isn't an objref that points to the graph. So
click on the graph's menu box (in the upper left corner of its canvas)
carefully move the cursor up to "View . . . " so that the graph's secondary menu appears
then carefully move the cursor over to the secondary menu and drag it down to the "Object Name" item

hoc will then print the name of the graph. It will look something like
So the hoc command would be
Graph[1].exec_menu("Keep Lines")
PlotShape[0].exec_menu("Keep Lines")
thanks Ted

Re: Shape shape plot in hoc

Posted: Fri Apr 12, 2013 11:07 am
by ted
Thank you, adamimos. For anyone who might still have a question about the solution to your particular problem, you
1. discovered (or already knew) the name of the PlotShape you wanted to use for a false-color display of membrane potential throughout the branched architecture of your model cell--for the sake of this example, let's say it was psname
2. executed
psname.exec_menu("Shape Plot")