Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.2 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Graphics > figure_operations > clf

clf

Clear or reset or reset a figure or a frame uicontrol.

Calling Sequence

clf([opt_job_arg])

clf(figureHandle[, opt_job_arg])
clf(num[, opt_job_arg])

clf(frameHandle[, opt_job_arg)

Arguments

figureHandle

A handle: the handle of the figure to clear or reset.

num

An integer value: the figure_id of the figure to clear or reset.

frameHandle

A handle: the handle of the frame to clear or reset.

opt_job_arg

A string which specifying the job for clf. Its value can be "clear" (default) or "reset".

Description

The clf command can be used to reset a figure to its default values and/or to delete all its children. If can also be used to delete all the children of a frame.

First input argument:
num

clf(num,..) clears or resets the figure with figure_id==num

figureHandle

clf(figureHandle,..) clears or resets the figure pointed to by the handle h

job

clf(job) clears or resets the current figure.

Second input argument:
"clear" (default)

clf(.., "clear") clears the targetted figure or frame.

  • All its children are deleted: axes, uicontrols, menus (for figures only), ... To prevent menus and uicontrols from being deleted from a figure, the delete(gca()) command might be used instead.
  • Its event handler is disabled: .event_handler_enable = "off"
  • The message in the status bar is cleared: .info_message = ""
All other figure's properties are unchanged.

"reset"

Used for figures only, clf(.., "reset") deletes all children of the specified figure. In addition, all figure's properties are reset to their default values as returned by gdf. The only exception are the axes_size and figure_size properties, which can not be reset if the figure is docked with other elements.

Examples

f4=scf(4);  //creates figure with id==4 and make it the current one
f4.color_map = jetcolormap(64);
f4.figure_size = [400, 200];
plot2d()
clf(f4, "reset")

f0=scf(0); //creates figure with id==0 and make it the current one
f0.color_map = hotcolormap(128); // change color map
t=-%pi:0.3:%pi;
plot3d1(t,t,sin(t)'*cos(t));

clf() // equivalent to clf(gcf(),"clear")
plot3d1(t,t,sin(t)'*cos(t)); // color_map unchanged

clf(gcf(), "reset")
plot3d1(t,t,sin(t)'*cos(t)); // color_map changed (back to the default one with 32 colors)

fr = uicontrol("Style", "frame", "Position", [20 20 200 200]);
a=newaxes(fr);
plot(1:10);
clf(fr);

See Also

  • figure properties — description of the graphics figure entity properties
  • gcf — Return handle of current graphic window.
  • gdf — Return handle of default figure.
  • scf — set the current graphic figure (window)
  • set — set a property value of a graphic entity object or of a User Interface object.
  • get — Retrieve a property value from a graphics entity or an User Interface object.
  • graphics_entities — description of the graphics entities data structures

History

VersionDescription
5.5.0 clf works for all axes parents (figures and frames).
Report an issue
<< figure_operations figure_operations drawlater >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Apr 01 10:13:57 CEST 2015