Page 1 of 1
Adding a length scale bar to a Shape plot
Posted: Tue May 21, 2013 8:03 pm
by neuromau
I would like to add a length scale bar to a shape plot, and a label ("100 um"):
Code: Select all
create soma, dend
connect dend(0), soma(1)
objref ss
ss = new Shape()
ss.label(0.1,.1,"100 um")
I thought perhaps I should use ss.beginline(x1,0.1) and ss.line(x2,0.1), but that didn't work for me (plus unsure of the unit conversion if it did work). How do I add the length scale to the shape plot?
Re: Adding a length scale bar to a Shape plot
Posted: Tue May 21, 2013 10:06 pm
by ted
Allow me to present anatscale.hoc (part of the extracellular_stim_and_rec.zip package):
Code: Select all
// set up xyz scale bars
create xScale, yScale, zScale
proc anatscale() {
if ($4>0) { // if length arg is <= 0 then do nothing
xScale {
pt3dclear()
pt3dadd($1, $2, $3, 1)
pt3dadd($1+$4, $2, $3, 1)
}
yScale {
pt3dclear()
pt3dadd($1, $2, $3, 1)
pt3dadd($1, $2+$4, $3, 1)
}
zScale {
pt3dclear()
pt3dadd($1, $2, $3, 1)
pt3dadd($1, $2, $3+$4, 1)
}
}
}
anatscale(100,0,0,100) // xyz coords of origin, and length
Re: Adding a length scale bar to a Shape plot
Posted: Wed May 22, 2013 8:58 pm
by neuromau
Awesome, thank you!