Using ModifyGraph command for a specific wave
steeve88
I am trying to make a program that automatically plots different graphs for meterological parameters. So, It's a long code.
However, I would like to ask if anyone knows anything about modifygraph command.
Let's say that I want to change the thickness of all of the contours on my graph. The contours come from a wave named as t_surface
what I do is:
wave t_surface
ModifyGraph lsize(t_surface)=2
However, I get an error message that this trave is not on the graph. I tried to use the name of the wave (as string, using $ firstly) instead of the wave, but I got the same error.
The reason I want to do that is because I want to plot two different sets of contours on the same graph. So, I need to handle them separately.
Any thoughts?
DoWindow /F nameOfGraph
to bring the correct graph to the front before your ModifyGraph line. Or you can useModifyGraph /W=nameOfGraph ...
.January 18, 2016 at 02:35 pm - Permalink
the window is active, so dowindow doesn't work here.
I used modifygraph/w=graph0 (as this is the name of the graph) and I got the same error:
While executing ModifyGraph, the following error occured: trace is not on graph.
Sometimes IGOR get me on nerves, as it makes such easy things a bit more complicated.
January 18, 2016 at 03:01 pm - Permalink
The contours are traces with their own names. So you need to use TraceNameList with 2 for the last parameter, to get a list of contour trace names. Here is an example:
String graphName
String contourName
String list = TraceNameList(graphName, ";", 2)
Variable numContourTraces = ItemsInList(list)
Print numContourTraces
Variable i
for(i=0; i<numContourTraces; i+=1)
String name = StringFromList(i, list)
Printf "Contour %d, name=%s\r", i, name
ModifyGraph lsize($name) = 3
endfor
End
January 18, 2016 at 06:36 pm - Permalink
However, there is one more problem now.
When I plot one set of contours and I want to plot another set on the first one, the "string list" includes both previous set's countour names and curent's.
As a result, at the end, ALL contours of the graph are plotted in the same way (same thickness, pattern etc.)
What I did was to count the number of traces before plotting the second countour set and to used this number as the start of the for loop. It works, but I was wondering if there is a better technique.
January 19, 2016 at 02:49 am - Permalink
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 19, 2016 at 10:40 am - Permalink
January 20, 2016 at 03:37 am - Permalink