Is there a way to hide a drawing layer?

I would like to either hide an entire drawing layer (so any drawings/pictures in it are invisible), or hide individual items in a drawing layer. By "hide" I mean all the items are still there, so that a simple "unhide" command shows them again.

One option is to capture the contents of the drawings using SetDrawEnv gstart, name=... (your drawing commands) SetDrawEnv gstop. You can delete or restore this captured environment as you need. As an easier approach, you might consider drawing a non-transparent box on top of the existing items to hide them, and then remove the box cover as needed to unhide them.

You can also use

DrawAction/L=userfront commands

to save the commands needed to redraw a layer, then

DrawAction/L=userfront delete

to delete the layer.

To recreate the layer, step through the lines of s_recreation and execute each in sequence:

function RecreateLayer(string s_recreation)
    wave/T w = ListToTextWave(s_recreation, "\r")
    for (string s : w)
        Execute s
    endfor
end