Removing the axis from an image in a user function

I have a 2D image named image that I append to a panel using the path hostpanel#subpanel. How can I use this information in conjunction with modifygraph to set margin=-1? This works fine if I just type newimage image in the control panel, giving me my image under Graph0:image.

Modifygraph/w=graph0 margin = -1

However If I make a panel named testpanel and append the image to it, I can no longer use this command. I also cannot use modifyimage which seems more appropriate, because the margin flag does not exist here.
Sorry, went back on one of my older threads with a similar problem and found the answer.

Solution was to add the /N=(graph_name) flag to the display command used before appending the image to the panel, then add
this to the panel path /w=hostpanel#subpanel#graph_name

works fine now.