Use dimlabels in legend

I frequently store data in 2D waves where I will later like to plot each column or row together.
I understand that I can use a fake waterfall plot to do something like this, the problem is, I want the data crossing each other not offset.
I have been simply appending each column or row to a plot.
When I add a legend, the text of course is something like wave0, wave0 #1, wave0#2, etc.
Alternatively, what I am hoping to do is use dimlabels as legend strings.

Is there a convenient , "built-in" way to do such a thing?

I can store each wave separately in a folder and this becomes a non-issue.
However, I typically perform other various manipulations to the data where this becomes a nuisance.
Other than plotting, it is more convenient for my application to have the data in a 2d wave.

So again I ask, can dimlabels be used in a plot legend in some straightforward way?
You can call GetDimLabel from the legend. Here is an example:
Function Demo()
    Make/O/N=(3,128) test = sin(q/(8+p))
    SetDimLabel 0, 0, FirstRow, test
    SetDimLabel 0, 1, SecondRow, test
    SetDimLabel 0, 2, ThirdRow, test
    Display test[0][], test[1][], test[2][]
    ModifyGraph rgb(test#0) = (65535, 0, 0)
    ModifyGraph rgb(test#1) = (0, 65535, 0)
    ModifyGraph rgb(test#2) = (0, 0, 65535)
    Legend/C/N=text0/J/A=MC "\\s(test) \\{GetDimLabel(test,0,0)}\r\\s(test#1) \\{GetDimLabel(test,0,1)}\r\\s(test#2) \\{GetDimLabel(test,0,2)}"
End

Dimension labels are a nice way to go, and have the advantage of storing the label with the wave.

If you've already got a routine to append columns or rows to graphs, you might consider the "trace name" keyword which allows you to assign a trace name to a wave (not the same as the wave name). More info available by issuing on the command line:

 DisplayHelpTopic "Programming with Trace Names"

Working from the very nice previous example:
Function Demo_TN()
    Make/O/N=(3,128) test = sin(q/(8+p))
    Display test[0][]/TN=FirstRow, test[1][]/TN=SecondRow, test[2][]/TN=ThirdRow
    ModifyGraph rgb(FirstRow) = (65535, 0, 0)
    ModifyGraph rgb(SecondRow) = (0, 65535, 0)
    ModifyGraph rgb(ThirdRow) = (0, 0, 65535)
    Legend/C/N=text0/A=MC
End
The trace names are a good idea - I am always up for saving a few lines of code.
Thanks.
How would I go about freezing my legend.
Now that I have spent some effort into getting my nice legend, I want to add more traces, but I do not want the legend to auto update.
Any suggestions on how to do this programatically?

I know that I can save a recreation macro and then go back and use that string, but it seems this will not work programatcially.
Any other ways to "print" the string the legend command would create?
[quote]How would I go about freezing my legend.[/quote]

Use Textbox to create it instead of Legend. For example:
Make jack=sin(x/8)
Textbox/C/N=text0 "\s(jack) jack"


Use AppendText to add lines to it later.

If you have an existing graph with a complex legend that you want to convert to a textbox, close the graph creating a recreation macro. In the macro replace Legend with Textbox. Execute the macro to recreate the graph.

To convert a legend to a textbox programmatically you would need to read the legend text using AnnotationInfo, create the textbox, and kill the legend.

[quote]Any other ways to "print" the string the legend command would create?[/quote]

Yes, using AnnotationInfo.

The "Annotation Proc" WaveMetrics procedure file defines a AnnotationText function that you might want to steal.