how to make an image over some background picture?

1 次查看(过去 30 天)
Hello,
I am gradually drawing an image on axes (creating the effect of image "slides in"), using
set(gca,'xlim',[0 120*fps],'ylim',[0 25],'nextplot','add','ydir','reverse');
Question is, the default background is a a simple white plane. How can I change it to my own picture?
I mean, if I place my picture on that axes, then the xlim and ylim becomes the size of the picture and I loose the settings I've made in an earlier command.
THANK YOU

采纳的回答

Mayank Dwivedi
Mayank Dwivedi 2016-2-9
Hi Mark,
The link below describes how to add an image to the axis:
The answer mentioned in the link above plots an axis then uses a custom image as it's background. This axes is then made invisible and to plot again a new axes is used.
When you plot again, the new axis will also have a white background. To make the axis transparent and make the background picture visible you need to set the axis 'Color' property to 'None' after you have plotted the data. For example, after making the first axis invisible as described in the link above you do the following to plot the data with background image visible-
>> set(ha,'handlevisibility','off', ...
'visible','off')
>> ha2 = axes('position',[0.3,0.35,0.4,0.4])
>> plot(rand(4))
>> set(gca, 'Color', 'None')
You can try implementing the "slide in" effect as you mentioned with the new axis. If you still face the issue please share the script that you are using.
Thanks,
Mayank

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by