Shape shape plot in hoc

Anything that doesn't fit elsewhere.
Post Reply
adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Shape shape plot in hoc

Post by adamimos » Thu Apr 11, 2013 2:09 pm

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()
g2.variable("gIhbar_Ih")
g2.flush()

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

THanks.

adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Re: Shape shape plot in hoc

Post by adamimos » Thu Apr 11, 2013 2:13 pm

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.

Cheers,
Adam

adamimos
Posts: 45
Joined: Mon Jan 25, 2010 4:49 pm

Re: Shape shape plot in hoc

Post by adamimos » Thu Apr 11, 2013 11:07 pm

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
http://www.neuron.yale.edu/neuron/stati ... #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()
or
foo = Shape()
or
foo = PlotShape()
then
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
Graph[1]
or
PlotShape[0]
So the hoc command would be
Graph[1].exec_menu("Keep Lines")
or
PlotShape[0].exec_menu("Keep Lines")
thanks Ted

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

Re: Shape shape plot in hoc

Post by ted » Fri Apr 12, 2013 11:07 am

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")

Post Reply