GUI Backgroundimage is disappearing if my programm is doing a plot

조회 수: 6 (최근 30일)
claudia busche
claudia busche 2012년 1월 14일
Hi, I have a Gui with a Slider and a Pushbutton. After i startet just the GUI, i have my Background Image inside of the Axes of my GUI. I stored the Image in the Opening Function via:
backgroundImage = importdata('vulkan_Bild.jpg');
axes(handles.axes1);
image(backgroundImagage);
The Value from the slider is give away to my extern programm a new initial condition. If i'm pressing the pushbutton my extern programm is running and then plotting (with "plot")the results inside of my axes from my gui. But then my backgroundimage is disappearing. I just have left an white background with the plot instead the background Image with the plot.
How can i make it happen, that the background Image is underlaying the plot?
Thanks so much in advance!
Claudia
  댓글 수: 1
Image Analyst
Image Analyst 2012년 1월 14일
Maybe try image(backgroundImage) instead of image(backgroundImagage)??? (Unless that was just a typo, not a copy and paste of your code).

댓글을 달려면 로그인하십시오.

답변 (2개)

Image Analyst
Image Analyst 2012년 1월 14일
Put "axis on" to see what the units are. If your image is 800x600 and you're trying to plot some line plot in the range -10 to +4, then the units don't match up. Actually I've never tried to do a line or bar plot in the same axes where an image already lives but I know that if you put lines and text up over the image with line() or text() you need to pass in x and y in pixel coordinates.
By the way, why are you using importdata() rather than the more common imread()? You also might use imshow() rather than image() because imshow() has more options and control over image display properties.

Walter Roberson
Walter Roberson 2012년 1월 14일
The default background color for axes is white. Set the axes 'Color' property to 'none' (and if necessary, re-set that each time the other code produces a plot.)
  댓글 수: 3
Image Analyst
Image Analyst 2012년 1월 14일
Show ALL your code including where you display the image and then display your plot with the plot() function or however you do it.
Walter Roberson
Walter Roberson 2012년 1월 14일
Which MATLAB version are you using? I may have seen something about a R2011b change such that 'none' would mean use the figure color instead of using whatever was underneath, but I am not certain of this.
In any version, you have to be very careful about which is the current axes; if your current axes was accidentally the background plot and "hold on" was not set, then the normal internal cla that is done would wipe out that axes.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by