Programmatically remove shape plot label

Using the graphical user interface to build and exercise models. Includes customizing the GUI by writing a little bit of hoc or Python
Post Reply
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Programmatically remove shape plot label

Post by neuromau »

Hello, I made a plot using hoc:

Code: Select all

create soma
objref g
g = new PlotShape(0)
g.variable("v")
g.view(-199.999, -147.615, 399.998, 295.23, 49, 151, 467.1, 344.8)
g.exec_menu("Shape Plot")
How can I then remove the "v" label from the plot itself using hoc? I understand how to add labels, but I am not sure how to manipulate (edit text, remove, move) existing labels from a plot using hoc. When I save a ses file before and after doing this via the GUI, it doesn't change at all. Thanks.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Programmatically remove shape plot label

Post by ted »

You're creating a PlotShape; that's what PlotShapes do. Create a Shape instead.
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Re: Programmatically remove shape plot label

Post by neuromau »

If I create a Shape instead, I won't be able to use the

Code: Select all

.variable("v")
method though, correct?

I still want the PlotShape functionality, I just don't want the label text to appear directly on top of the plotted cell. Should I try changing the 3d coordinates of the cell or experimenting with g.view() instead to move the cell to the side of the graph, assuming the label will always appear in the same location?
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Programmatically remove shape plot label

Post by ted »

neuromau wrote:If I create a Shape instead, I won't be able to use the

Code: Select all

.variable("v")
method
True because the Shape class doesn't have a variable() method.
I still want the PlotShape functionality, I just don't want the label text to appear directly on top of the plotted cell.
Can't say that I've ever seen a PlotShape whose variable name wasn't displayed close to the root section; you can try changing the location of the cell, but I'd be surpised if that does anything useful. On those occasions when I need something aesthetic, e.g. a false color plot of v over an entire cell, it's easy to use the PFWM to generate an Idraw file, then edit that with idraw or Corel Draw to remove the variable name.
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Re: Programmatically remove shape plot label

Post by neuromau »

On those occasions when I need something aesthetic
Okay, hmm. My problem now is that I have many dozens of those occasions so I will have to stick with something programmatic. The variable I am plotting is not actually "v", but one that is 10-18 characters long and tends to obscure a good portion of my cell. I may make a dummy variable with a one-character name, set the other variable equal to it, and plot that one instead.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Programmatically remove shape plot label

Post by hines »

The label is always placed at 0,0 in model coordinates. You can manually move it using the PlotShape menu, selecting "Move Text" and dragging the variable to another location.
Or put the cell somewhere away from 0,0 . The latter is the only thing you can do under program control from HOC.
If you are willing to do surgery on the nrn/src/nrniv/shapeplot.cpp file in the void ShapePlot::variable(Symbol* sym) {
just comment out the
append_fixed(new GraphItem(g, 0));
line and it will not appear on the canvas.
neuromau
Posts: 97
Joined: Mon Apr 20, 2009 7:02 pm

Re: Programmatically remove shape plot label

Post by neuromau »

Thanks, I was able to move the cell far enough away that the label doesn't appear anymore. I will remember the .cpp edit option in case I decide to compile NEURON later.
Post Reply