Reset Axes in Matlab

10,404

Solution 1

After you clear the image, issue this command

set(gca,'xtick',[],'ytick',[],'Xcolor','w','Ycolor','w')

you can replace gca with your current handle.

Solution 2

The easiest solution may actually be to leave out the 'reset' argument to CLA:

cla(handles.image);

This will have the effect of clearing the image object from the axes, but leaving the axes settings unchanged (i.e. the axes will still be invisible).

Share:
10,404
Nadeeshani Jayathilake
Author by

Nadeeshani Jayathilake

Updated on June 04, 2022

Comments

  • Nadeeshani Jayathilake
    Nadeeshani Jayathilake almost 2 years

    There is a axes named image in which I show the image when the user presses the browse button.

    imshow(orgImg, 'Parent', handles.image);

    Then I do image processing stuff.

    There is a clear button to clear that image shown in image axes after done all the processing. I used cla(handles.image,'reset'); This clear the image from axes. But, it displays the XTick and YTick as 0, 0.5, 1, 1.5 and so on and also XColor and YColor as black.

    I don't want XTick and YTick values to be displayed on axes and also color should be white. But I need to display the axes without above values. Now it shows the axes with above values.

    How can I remove those properties?

    • Nadeeshani Jayathilake
      Nadeeshani Jayathilake about 13 years
      I found the answer. :) cla(handles.image,'reset'); set(handles.image,'YTick',NaN); set(handles.image,'XTick',NaN); set(handles.image,'XColor','white'); set(handles.image,'YColor','white');