How to change the color of sections in a Shape plot

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

Moderators: wwlytton, tom_morse

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

How to change the color of sections in a Shape plot

Post by ted » Fri Mar 16, 2007 3:16 pm

The Shape class has several methods that can be used to change the color of one or more
sections in a Shape plot--see color, color_all, and color_list at
http://www.neuron.yale.edu/neuron/stati ... shape.html

These same methods can be used to change the appearance of a Shape plot that is part of
a GUI tool. For example,
NEURON Main Menu / Tools / Impedance / Shape
brings up an "imdedance shape tool" (called ImpShape) which has two Shape plots: one
that shows a side view of the anatomy of a model, and another that shows the side view
of the "neuromorphic rendering of the electrotonic transformation" of that model (see
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=771 for more information).

A NEURON user asked how to make the transforms of the basal and apical dendrites,
which appear in the bottom panel of the ImpShape tool, have different colors. Here's how:

The Shape class has a color_list() method that can be used to specify the color of all
the sections that belong to a SectionList, e.g. by
shapeobj.color_list(sectionlist, colorindex)

The first step is to make sure you have a couple of SectionLists, one which contains the
basilars and the other which contains the apicals. If your model cell is managed by a
CellBuilder, this is easy--just use the CellBuilder's Subsets page to set up two subsets
that contain the sections you want to color. The subsets are actually just SectionLists.
My guess is that the SectionLists will be numbered in the same order as the subsets, i.e.
0, 1, . . .

Of course you also have to know the name of the Shape in the ImpShape tool. Click on
the Shape's menu box, and at the bottom of its secondary menu you'll see the item
"Object Name". Select that, and the "real" name of that Shape object will be printed in
NEURON's xterm. For example, I'm doing this now with the pyramidal cell model that
is included with NEURON's neurondemo program, and I see that the ImpShape's
transform is drawn in Shape[2].

And you also need the numerical value of the colorindex that will make the sections have
the color you want. This is discussed in the documentation of the Graph class's color()
method--see
http://www.neuron.yale.edu/neuron/stati ... html#color
So if my pyramidal cell had a sectionlist called basilars and I wanted to make them red,
I'd type
Shape[2].color_all(basliars, 2) // 2 is the index for red
at the oc> prompt.

Post Reply