MATLAB: Inserting image in plot

icon in plotimage in plotplot

Hello,
I want to include a small .png image in a plot. I've already been looking all over, and it seems
test=imread('image.png'); axes('position',[.5 .5 .1 .1]); imagesc(test);
could do it, but the problem is: whenever I want to continue plotting other things, they will also appear in that small square, but I want them to appear in the normal/surrounding plot. How can I switch back?
Or can you maybe suggest a better method for including a small icon?
Thank you, Ruben

Best Answer

You do not need to create a new axes. Instead, you can pass position arguments to imagesc() exactly the same way you can pass them to image()
imagesc([.5 .5], [.6 .6], test)
Note, though, that the above will not position in exactly the same place as the axes() case: the position for image() and imagesc() is the coordinates of the center of the corner pixels, not the outside edge of the corner pixels.