how to make an image over some background picture?

1 vue (au cours des 30 derniers jours)
Mark Golberg
Mark Golberg le 7 Fév 2016
Commenté : Mark Golberg le 10 Fév 2016
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

Réponse acceptée

Mayank Dwivedi
Mayank Dwivedi le 9 Fév 2016
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

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by