How to Place an image over existing plots?
364 次查看(过去 30 天)
显示 更早的评论
Hello, I have some graphs in Matlab over which I want to insert a small image. I do not want to cover the graphs completely, and want to know how to specify the exact position for overlaying this image onto the existing plots. I have used imread to read the file, but cannot seem to figure out imshow to display the image properly where I would like it to be.
0 个评论
采纳的回答
Chad Greene
2014-12-18
Hi Ashley,
Run this:
figure
plot((1:10).^2)
axes('pos',[.1 .6 .5 .3])
imshow('coins.png')
The axes command sets up a new set of axes on top of the x^2 plot, with the position of those axes as follows:
[bottomleftcornerXposition bottomleftcornerYposition width height]
4 个评论
JACQUES SPILLMANN
2020-4-25
How would I go about rotating that picture on the plot, let's say, by 10 degrees clockwise?
Dardag
2020-7-29
I am inserting a particular image in my figure but the resolution of the inserted image gets distorted if I create a smaller box for that, why would that be?
This is what I am using but I don't see any resolution options.
[img, map, alphachannel] = imread(fileName,'png');
image(img, 'AlphaData', alphachannel);
更多回答(1 个)
DGM
2023-3-22
This doesn't necessarily require creating another axes object. This can be done directly by setting xdata/ydata for image/imagesc/imshow.
See the example:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!