GUI Backgroundimage is disappearing if my programm is doing a plot

3 views (last 30 days)
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 Comment
Image Analyst
Image Analyst on 14 Jan 2012
Maybe try image(backgroundImage) instead of image(backgroundImagage)??? (Unless that was just a typo, not a copy and paste of your code).

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 14 Jan 2012
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 on 14 Jan 2012
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 Comments
Image Analyst
Image Analyst on 14 Jan 2012
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 on 14 Jan 2012
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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!