GraphInfo function?
ilavsky
Hello,
I need to check the type of graph (need to be XY), which axis are used, and few other things before I can do something. I can find functions ContourInfo, ImageInfo, TableInfo, all providing type of information I would like to get, but not GraphInfo.
What am I missing? Do I need to really go and ask for AxisList and other information one-by one?
Please note that ContourInfo, ImageInfo and TableInfo are more like TraceInfo than what a possible GraphInfo might return (though perhaps TableInfo(winname, -2) is like what you want).
Another possible answer is that a graph is such a complex and flexible thing that it's not really clear what we would put into it. The ultimate GraphInfo function, of course, is WinRecreation() :)
It seems like TraceInfo probably contains most of the information you need. It certainly has keywords XWAVE and YWAVE that can be used to detect an XY trace, and it has XAXIS and YAXIS keywords so that you can figure out the names of the axes. I can't speak to "a few other things" :)
December 22, 2020 at 01:39 pm - Permalink
Hi,
One way to start is to use the winrecreation function to return the window recreation string. Within that you can check for waveA vs waveB text as indicator of an XY graph. Quick example.
Window Graph0() : Graph
PauseUpdate; Silent 1 // building window...
Display /W=(35,45,430,253) Single_Var_A vs Single_Var_B
EndMacro
Andy
December 22, 2020 at 01:40 pm - Permalink
Well, I realize that Graph is complicated beast. But what is confusing me is how do I simply decide that I am looking at XY cartesian plot and not on box, contour, category, violin plot, polar plot, or any other exotic type of plots. Clearly, these are somehow recognized by Igor as such and specific tools are applied to them.
At this time I get AxisInfo and AxisList and work out that I have left/right and top/bottom axes and go from there on checking traces etc. But I worry that is not good enough. The good news is, that the way I want to use this number of graph types is really limited. But I was hoping to write something of general use and that is unlikely.
December 22, 2020 at 08:08 pm - Permalink
TraceInfo has the keyword TYPE:
0: XY or waveform trace
1: Contour trace
2: Box plot trace
3: Violin plot trace
TYPE was added in Igor Pro 8.00.
So a value of zero is what you're looking for; to get XY or Waveform you then need to check the XWAVE keyword.
January 4, 2021 at 11:39 am - Permalink
Nice, thanks. That is easy to do. Did not realize I need to look at traces and not at Graph itself. But makes sense.
January 4, 2021 at 12:19 pm - Permalink
Yes, a graph can mix together traces of arbitrary different types. This is one of Igor's great strengths- many graphing applications have you create a scatter plot graph or a parametric graph or a line graph, etc. And then to make a graph that shows both scatter plot (that is, markers at random places) and a line plot requires gyrations to combine two "graphs".
Igor just lets you combine things any way you want.
January 4, 2021 at 01:35 pm - Permalink