
Calibration bar within subwindow

chrisNell
I need to plot calibration bars in my electrophys graphs instead of regular axis with multiple subwindows. I have seen that there is a macro that can do it but this macro can't reach the subwindows.
When I use "Calibrator()" the macro window is opened but I am not able to interact with it.
When I try to trigger the function of interest from macro and gives it the name of my subwindows "WMNewCalibratorInGraph("subwin")", there is no effect.
So it will be wonderful if somebody know how to do it )))))
Function EasyGraph() String CDF, win, subwin CDF=GetDataFolder(1) Display/K=1/W=(0,0,600, 500) as "test" Win=S_name //Set the subwindows Variable i, j, Rows = 1, Columns = 2 for (i=0; i<Rows; i+=1) for (j=0; j<Columns; j+=1) Display/HOST=$Win/W=(j/Columns,i/Rows, (j+1)/Columns, (i+1)/Rows) MoveSubwindow fnum=(j/Columns,((i/Rows)*0.97)+0.03, (j+1)/Columns, (((i+1)/Rows)*0.97)+0.03) //CN move all the subwindow to allow the title in the beginning of the page endfor endfor SetActiveSubwindow $StringFromList(0, Win, "#") // Subwindow are set Subwin=Win+"#G"+num2str(0) appendToGraph/W=$subwin root:DA119_RPip_ch2_1000 //Name of a specific wave ModifyGraph/W=$Subwin nticks=0,noLabel=2,axThick=0 //WMNewCalibratorInGraph("subwin") //Test, idea is to put the basic calibration bar Subwin=Win+"#G"+num2str(1) appendToGraph/W=$subwin root:DA119_RPip_ch3_1000 ModifyGraph/W=$Subwin nticks=0,noLabel=2,axThick=0 Calibrator() // Idea is to open the calibrator menu and then put it by hand. The calibrator menu is open but I am not able to interact with it End <pre><code class="language-igor">
but I still have problem with GetAxis and AxisInfo when I use subwindow... thanks if you have any advice regarding these command with subwindow
September 2, 2015 at 05:55 am - Permalink
I created a graph and added a calibrator to it. Then I used the second utility above to embed this in another graph. The subgraph was successfully embedded, but the Calibrator drawing DID NOT appear in the embedded subgraph.
An awkward solution is to use the Calbrator in the parent graph, and drag it over your subgraph. The disadvantage to this is having to get the correct Calibrator scale factors (which follow the parent graph). One way to do this is to create new free axes so that the embedded subgraph's axes match smaller regions of the parent graph free axes. Apply the free axes scaling when using the calibrator GUI window. You can then hide the free axes using zero thickness and turning off labels.
September 2, 2015 at 09:40 am - Permalink
September 2, 2015 at 11:02 am - Permalink
I have used the include, so the problem is really to have access to the graph within the subwindow. As it was impossible to use function such as getAxis and AxeInfo, I have use the traces and done it manually with:
September 3, 2015 at 05:38 am - Permalink
String info = AxisInfo("Graph0#G0", "Left")
will deposit the info string into the string variable "info".
Most functions and operations that get information or manipulate graphs have a way to specify a subwindow.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
September 3, 2015 at 10:35 am - Permalink
For your enjoyment, I've attached the procedure files and a screen shot showing the revised panel at work.
The panel now adds the calibrator to the active sub window or active top-level graph.
Replace your existing Axis Utilities.ipf and Append Calibrator.ipf files in the WaveMetrics Procedure folder with the attached files.
Let me know if you find them useful or if they have problems.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
September 3, 2015 at 11:32 am - Permalink
It works perfectly, thanks a lot Jim!!!
I used Execute in the loop that goes through all the subwindow to put my scale bar within them:
September 8, 2015 at 02:15 am - Permalink
But this function is great, only the position of the scale bar is a bit tricky because for multiple graph, if I move it manually, even by double clicking on it, I can't set up the exact position.
Best
Chris
September 8, 2015 at 08:55 am - Permalink
The attached revision of Append Calibrator.ipf has controls to position the calibrator, and WMNewCalibrator has optional parameters, too:
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
September 8, 2015 at 12:12 pm - Permalink
The last thing that can still be improved is the possibility to rotate the all the text for the y-axis by 90° like in the units regular graph axis. I can do it by selecting the text box -> ungroup ->selecting text, ->text orientation -> 90°
But as I wanted to automatize everything, if you have an idea to do it faster let me know.
September 9, 2015 at 06:41 am - Permalink
The attached revision will do that.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
September 10, 2015 at 11:01 am - Permalink
September 15, 2015 at 08:41 am - Permalink
I have a small question because I have an error that comes all the time when I try to target specific function form Calibrator:
While executing SetVariable, the following error occurred: No child data folder of that name exists.
I use it with this code:
September 22, 2015 at 09:13 am - Permalink
They won't execute until after the function returns.
Also, why not call the underlying routine explicitly instead of calling the panel code?
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
September 22, 2015 at 09:23 am - Permalink
Cheers
Chris
September 23, 2015 at 12:19 am - Permalink
To be sure it's not an experiment-specific problem I made a blank new experiment and just created two waves, displaying both in separate graphs. When I subwindow one into the other, I can still append a calibrator in the main graph, but as soon as I click into the subwindow area and click on "add calibrator to layer" or even just the calibrator panel, I get the following error message in the history:
** DoWindow gave error: names must start with a letter and contain letters, digits or '_'
Using the debugger I trailed this problem to the line " list=HVAxisList(graphName,1) // horizontal axes, if any" in the following part:
When I clicked in the subwindow area and then try to open the calibrator panel from the menu bar, I get the error message:
"While executing SetVariable, the following error occured: No child data folder of that name exists"
This error message appears when debug-switching from 3rd to 4th line, and yeah, indeed, there is just a sub-folder series WMCalibrator:Graph0:Graph1, nothing that corresponds to the part called in the ipf.
Is there a way for you to fix these problems?
Yours, Dominik
November 3, 2017 at 09:30 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
November 3, 2017 at 09:43 am - Permalink
Twice in the beginning, calling the CalibratorPanel
and once later:
So I see actually no reason fot he problem to occur at the positions shown by the debugger...
But, there is the "axis utilities.ipf" which seems to be the actual problem, at least for the DoWindow error message (remember, it was evoked when reaching the HVaxislist part):
November 3, 2017 at 09:52 am - Permalink
You also need the attached Axis Utilities: it doesn't use DoWindow the way you show above, and doesn't suffer from this limitation.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
November 3, 2017 at 10:27 am - Permalink
November 5, 2017 at 04:11 am - Permalink