## .label(x, y, "label") in axes coordinates

Anything that doesn't fit elsewhere.
pfortier
Posts: 47
Joined: Thu Apr 20, 2006 8:02 am
Location: University of Ottawa

### .label(x, y, "label") in axes coordinates

To plot the voltage vectors of an n*m sheet of cells, I set gobj.size() to accommodate n*m vectors, offset the (x,y) values of each vector accordingly, and then use vector.line() to plot the data.

I wanted to label my traces. I found graph.label(x, y, "label") but this uses window coordinates so when you zoom or move around it is inappropriate.

Is there a graph.label(x, y, "label") that would draw text based on axes coordinates? This would allow me to label my traces and their position relative to the data would remain with zooming. If there isn't such a command, (1) is there another method or (2) would it be simple for someone with medium programming knowledge to code this feature based on the source code for graph.label(x, y, "label") and vector.line()?

Thanks,
Pierre

hines
Posts: 1586
Joined: Wed May 18, 2005 3:32 pm

### Re: .label(x, y, "label") in axes coordinates

http://www.neuron.yale.edu/neuron/stati ... html#label
gives the many arg form:
.label(x, y, "string", fixtype, scale, x_align, y_align, color)
you want fixtype=2 or fixtype=1 depending on your purpose.

pfortier
Posts: 47
Joined: Thu Apr 20, 2006 8:02 am
Location: University of Ottawa

### Re: .label(x, y, "label") in axes coordinates

To place a label aligned on axis coordinates, the following code seems to work well.

// labelcoordinate=lblxy(xORyCase,graph,axiscoordinate): converts axis to label coordinate

Code: Select all

``````func lblxy() { return \$o2.view_info(0, \$1, \$3)+\$3 }
objref g
g = new Graph()
g.size(0,100,0,100)
g.label(lblxy(11, g, 20), lblxy(12, g, 60), "MyLabel", 1, 1, 0.1, 0.1, 3)
``````
Thanks,
Pierre