Using ModifyGraph command for a specific wave

Hello again,

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?
Just a guess: the window you want to modify is not active. You can use DoWindow /F nameOfGraph to bring the correct graph to the front before your ModifyGraph line. Or you can use ModifyGraph /W=nameOfGraph ....
Thank you for the reply,

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.
Quote:
The contours come from a wave named as t_surface...
what I do is:
wave t_surface
ModifyGraph lsize(t_surface)=2


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:

Function Demo(graphName, contourName)
    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
Thank you for the reply. That was really helpful.

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.