Naming graph windows and avoiding Igor renaming


A few times I've run into the following problem: it seems that new graph windows cannot be named using the name of an existing wave. This doesn't seem to be documented - maybe I missed it.

An example:

Function DoStuff()
    Make/O aaa,bbb
    String plotName = "aaa"
    KillWindow/Z $plotName
    Display/N=$plotName aaa vs bbb
    plotName = "ccc"
    KillWindow/Z $plotName
    Display/N=$plotName aaa vs bbb

This gives two windows, one named aaa0 and one called ccc. If the function is run again, ccc is killed and recreated but aaa0 remains (obviously) and aaa1 is created. This is a silly example, I do try to create plotNames that are not identical e.g. by using a prefix and then the wave name.

In the help it does say that you can use the S_name string to know what name Igor actually gave to the window, but this isn't ideal because then I would have to pass that string on to subsequent functions rather than having them work out the plotName for themselves.

I guess my question is whether this is a bug or feature?

p.s. in the help it recommends DoWindow/K for killing, I thought KillWindow is the new standard for functions?

This may not be a satisfying answer to your question, but I never give graphs a specific name and rather look up the name with WinName(0,1). Is this a solution for your task? Of course this will be inconvenient if the graph you want to attack is not the top graph, but the you may work on it with WinList("thenameofyourdata*", ";", "WIN:1").


In reply to by chozo

DisplayHelpTopic "Name Spaces"

See the table below that shows the four global name spaces:

Waves, variables, windows    Names must be distinct from other waves, variables (numeric and string), windows.

Setting window names in a function can be perilous. This is a copy of an email exchange with Howard Rodstein from a year ago:



this seems inconsistent, because both wave names and window names need
to be distinct from function names.

I agree, it is inconsistent.

I could fix this by making CheckName(6) also do CheckName(1) and vice versa. I'm somewhat nervous about it because it might cause problems with existing procedures. If I do it, it will be for Igor8.

In the mean time, you can call both yourself when calling either. You don't need to call FunctionList and MacroList as CheckName(1) checks for procedure name conflicts.

Howard Rodstein
WaveMetrics, Inc.
Phone (503) 620-3001

On Fri, Sep 1, 2017 at 3:04 PM PDT, Tony Withers <> wrote:
I have a function ant0.

•print checkname("ant0", 1)
•print checkname("ant0", 6)

this seems inconsistent, because both wave names and window names need
to be distinct from function names.

Is this a bug?

If not, do I really have to use checkname, functionlist AND macrolist to
check for potential name conflicts when renaming windows in a function?


Thanks all for the replies.

@chozo - I could do this. Thanks for the suggestion.

@aclight - this answers my question. It's just the way it is.

@tony - I hadn't thought about other conflicts. Checking the name makes sense.