From: George on
Here's a quick summary of what's going on. First, a matrix of data is displayed on the plot axes using the imagesc(x) function. Then, another transparent layer is placed on top of the matrix that has just been plotted. Then, we wrote some functions that allow the user to draw lines on this "transparent" layer and the matrix values on the original layer are then recorded in an array.

The problem i'm having is that when i use something like cla(handles.input_axes,'reset'), the matrix of data that was plotted using imagesc is cleared, however, the transparent layer is not cleared. The axis labeling and the lines that have been drawn continue to stay on the plot and it creates a cluttered screen. I have tried clearing the "transparent" layer with something like clear A2; but the issue still remains.
I have a feeling it might have something to do with the way the transparent layer is being created and positioned on top of the plot axes.

Here is the block of code where i think the problem exists:

%display the interpolated image - axes pointed to input_axes plot
axes(handles.input_axes);
imagesc(X);
% define axes units in pixels and positions axes on the GUI
set(gca,'Units','pixels');
% displays the image using the colormap jet by default
cmap = 'jet';
colormap(cmap)
axis off

% displays a transparent axes on top of the image with dimensions
% that are equal to the image. This allows for the "drawing"
axes(handles.input_axes)
A2=axes('hittest','on','xlimmode','manual','ylimmode','manual');
set(A2, 'Units', 'pixels');
set(A2,'position',[356 259 256 256])
set(A2,'XAxisLocation','top','YAxisLocation','right');
set(A2,'XLim',[xmin xmax]);
set(A2,'YLim',[ymin ymax]);
set(A2,'Color','none');
From: Matt Fig on
It looks like your "transparent layer" is actually another axes (A2). If so, you will have to CLA it as well.
From: George on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <i37ctt$1t9$1(a)fred.mathworks.com>...
> It looks like your "transparent layer" is actually another axes (A2). If so, you will have to CLA it as well.

Matt, thanks for the tip. That actually helped to remove the lines that were being drawn on the plot, but a small issue still remains.
The old axis tick marks and labeling are not being cleared, so new labeling/tick marks are being drawn on and it makes the axes illegible. I'm assuming i might have to try adjusting some of the axes properties to fix this issue.
From: Matt Fig on
If I had to guess, I would say it is not the persistence of the old labels which is making things unreadable. I would say that you are actually creating a new A2 every time you run your code. See the line where you call the axes function with the handles.input_axes argument? That makes the argument the current axes. You never do the same for A2, so if you are running this code each time you are getting a new A2 by doing:

A2 = axes(.....)
From: George on
"Matt Fig" <spamanon(a)yahoo.com> wrote in message <i37u1b$o1p$1(a)fred.mathworks.com>...
> If I had to guess, I would say it is not the persistence of the old labels which is making things unreadable. I would say that you are actually creating a new A2 every time you run your code. See the line where you call the axes function with the handles.input_axes argument? That makes the argument the current axes. You never do the same for A2, so if you are running this code each time you are getting a new A2 by doing:
>
> A2 = axes(.....)

Gotcha! What I tried doing, and had success with, was giving each creation of "A2" a value; such as A2(cnt) where cnt is initialized as 1 and increments each time a new set of data is loaded. The axis labels are now being cleared completely because i'm addressing the proper instance of A2 when i say something like cla(A2(cnt)) and now my problem is solved. Thank you very much for your help Matt :)