How to normalize an image position in a subplot?
I have some data which I then overlay a figure on top of like this:
plot(rand(10),rand(10),’*’)
[img,~,alphachannel] = imread(‘ImageFile.png’);
axes(‘units’,’normalized’, ‘Position’,[0.35 0.23 0.35 0.35]);
image(img,’AlphaData’,alphachannel);
axis off
The position of the image on the figure is normalized, so even if the data I plot change scale, the image stays in the same position on the figure.
Now, this all works beautifully.
All I want to do is make this plot into a subplot instead of a standalone figure.
However, I can’t seem to figure out how to do this because the image position always gets referenced to the whole figure rather than the subplot.
Any solutions?I have some data which I then overlay a figure on top of like this:
plot(rand(10),rand(10),’*’)
[img,~,alphachannel] = imread(‘ImageFile.png’);
axes(‘units’,’normalized’, ‘Position’,[0.35 0.23 0.35 0.35]);
image(img,’AlphaData’,alphachannel);
axis off
The position of the image on the figure is normalized, so even if the data I plot change scale, the image stays in the same position on the figure.
Now, this all works beautifully.
All I want to do is make this plot into a subplot instead of a standalone figure.
However, I can’t seem to figure out how to do this because the image position always gets referenced to the whole figure rather than the subplot.
Any solutions? I have some data which I then overlay a figure on top of like this:
plot(rand(10),rand(10),’*’)
[img,~,alphachannel] = imread(‘ImageFile.png’);
axes(‘units’,’normalized’, ‘Position’,[0.35 0.23 0.35 0.35]);
image(img,’AlphaData’,alphachannel);
axis off
The position of the image on the figure is normalized, so even if the data I plot change scale, the image stays in the same position on the figure.
Now, this all works beautifully.
All I want to do is make this plot into a subplot instead of a standalone figure.
However, I can’t seem to figure out how to do this because the image position always gets referenced to the whole figure rather than the subplot.
Any solutions? image, figure, subplot MATLAB Answers — New Questions