Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to delete graphics in an axes?

Subject: How to delete graphics in an axes?

From: Sahra winter

Date: 21 Jan, 2010 17:12:20

Message: 1 of 6

Does any one know, how to delete graphical content of an axes without deleting it's handle?

Subject: How to delete graphics in an axes?

From: Nathan

Date: 21 Jan, 2010 17:44:16

Message: 2 of 6

On Jan 21, 9:12 am, "Sahra winter" <sahra18...@gmail.com> wrote:
> Does any one know, how to delete graphical content of an axes without deleting it's handle?

Doesn't deleting an object imply deleting its handle as well?

Do you mean delete the object but not the axes handle?

Do you mean make the object invisible on the axes?

Please clarify.

-Nathan

Subject: How to delete graphics in an axes?

From: Jomar Bueyes

Date: 21 Jan, 2010 18:17:19

Message: 3 of 6

On Jan 21, 12:12 pm, "Sahra winter" <sahra18...@gmail.com> wrote:
> Does any one know, how to delete graphical content of an axes without deleting it's handle?

If you meant to keep the axes but delete the plot within, you could do
something like

> plotHandle = plot(x,y, ... )

then, to delete the plot
> delete(plotHandle)

The axes and figure objects will remain, but the plot will be removed.

However, as Nathan explained, you cannot delete an object w/o deleting
its handle.

HTH

Jomar

Subject: How to delete graphics in an axes?

From: Husam Aldahiyat

Date: 21 Jan, 2010 19:37:04

Message: 4 of 6

You can use

cla

To clear your current axes. You can use

set(h,'visible','off')

to make your plot invisible, or use PATCH to cover the axes with a big white patch.

Subject: How to delete graphics in an axes?

From: Walter Roberson

Date: 21 Jan, 2010 20:00:25

Message: 5 of 6

Sahra winter wrote:
> Does any one know, how to delete graphical content of an axes without
> deleting it's handle?

help cla


     CLA RESET deletes all objects (including ones with hidden handles)
     and also resets all axes properties, except Position and Units, to
     their default values.


If you do not want the properties reset,

delete(allchild(AXISHANDLE))

This might, however, end up recomputing various axis limits such as xlim if
their modes are set to auto, so you might want to hold(AXISHANDLE) before
doing the delete().


Note that -in general- you *do* want to delete objects with hidden handles
within an axis. For example, if you use polar(), then several of the created
graphical objects have hidden handles as they are not intended to be
manipulated independently.

Subject: How to delete graphics in an axes?

From: Sahra winter

Date: 10 Feb, 2010 03:26:03

Message: 6 of 6

thanks for your helpful answers.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us