Stacked, multiple plots?

Anything that doesn't fit elsewhere.
Post Reply
mctavish
Posts: 74
Joined: Tue Mar 14, 2006 6:10 pm
Location: New Haven, CT

Stacked, multiple plots?

Post by mctavish »

I would like to perform a run and plot the results. I then want to make a change and perform another run. I want to see the results of my first run on one graph, and the results of my second run on another graph, aligned with my first run, but below it. Preferably, I'd like these graphs to be in the same window, but they do not have to be. I need to be able to lay them out, however, for print export.

How do I do this?

I see how I can perform a run and export the graphic of each run and then layout those graphics in another app, but I'd like to automate this in NEURON, and have just one export.

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

Post by ted »

I'd suggest deferring plotting until after the end of a run, and doing everything with Vectors.
Use Vector (or CVode record if using local variable time step) to capture the time courses
of variables of interest (don't forget to record t as well).
After each run,
--create a new Graph object and plot your recorded Vectors in it
--append that Graph object to a List so it doesn't disappear
--append the Vectors to another List (or multiple Lists, if you prefer to keep them separate)

You can automate this as much as you like, e.g. with something like
proc myrun() {
run()
plot_recorded_vecs() // create a new Graph and plot vectors in it
save_stuff() // append recorded vectors to a List, and the Graph to another List
}
so you can call myrun() from the oc> prompt, or make a little xpanel with a button
labeled "myrun" that calls myrun() when clicked.
You might also want to write another proc that deletes the saved data.
proc zap() {
objref name_of_list_of_vectors, name_of_list_of_graphs
}
and include a button for it in your xpanel.

How to control where your Graphs go--
Change myrun() so that every time you call it, it increments a variable that keeps
track of how many times it has been called.
Change zap() so that it returns this count to 0.
Pass this count as an argument to plot_recorded_vecs() and use it to control where
the next new Graph is placed. You can steal reusable code to place Graphs where
you want them from a session file--see this for an example
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=552
but just don't bother with the graphList / addvar / addexpr stuff.
Post Reply