Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - 日本語


clf

Clears and resets a figure or a frame uicontrol

Syntax

clf
clf reset
clf(numFig)
clf(numFig, "reset")
clf(figFrameHandle)
clf(figFrameHandle, "reset")

Arguments

numFig

Vector of indices of figures to clear or reset (.figure_id values). By default, the current figure is targeted.

figFrameHandle

Vector of handles of figures or frame uicontrol to clear or reset. Mixing figures and frames is possible. By default, the current figure is targeted.

"reset"
Provide this option keyword to reset properties of chosen figures to their default values, in addition to deleting the figures contents.

Description

The clf command can be used to delete all children of a given graphic window, hence clearing it. If the "reset" keyword is used, in addition most of the figure properties are reset to their default values. The detailled changes are now described:

  1. The following default actions are always performed:

    • All visible and invisible axes of each targeted figure or frame are deleted.
    • All menus whose figure.children handles are not hidden are deleted. It is possible to protect them with set(get(0), "ShowHiddenHandles", "off"). This then applies to all opened figures and forthcoming ones. See ShowHiddenHandles.
    • The message in the status bar of each figure is cleared.
    • The event handler of each figure is disabled, but their references are kept .

    Values of all figures properties are unchanged, except .info_message="" and .event_handler_enable="off" that are forced.

  2. "reset": in addition to default actions, "reset" resets most of figures properties to their default values, as specified by gdf(). This applies only to figures.

    • Some properties are never reset: The figure's number .figure_id is kept as is. .toolbar, .menubar, .layout, .layout_options, and .dockable can be set only once and so are never resettable.
    • For docked figures: .figure_position, .figure_size, and .axes_size are unchanged if the parent figure is docked to the Scilab's desktop or to another Scilab interface. Changing their value would change the position or size of the whole block of docked interfaces, not only the targeted figure.

Clearing specific parts of a figure

  • gcf().name = "" clears the name of the window, displayed at its very top left corner.
  • gcf().info_message = "" clears the message displayed in the status bar of the current figure.
  • delete(gca()) deletes the current axes in the current window. All other components of the window are kept: other axes (if any), menus, interactive components, figure properties, etc.
  • Deleting only all axes of a figure may be done with c=gcf().children; delete(c(c.type=="Axes")). This keeps all its other components: menus, interactive components, etc.
  • Deleting only menus: c=gcf().children; delete(c(c.type=="uimenu")). This assumes that get(0).ShowHiddenHandles is "on".

Examples

f4 = scf(4);  //creates figure with id==4 and makes it the current one
f4.color_map = jet(64);
f4.figure_size = [400, 200];
plot2d()
sleep(4000)   // wait and see for 4s
clf(f4, "reset")

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

clf        // is clf(gcf(),"clear"). Keeps the current color_map
plot3d1(t,t,sin(t)'*cos(t));

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

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

See also

  • figure properties — グラフィックエンティティプロパティの説明
  • ShowHiddenHandles — consoleオブジェクトプロパティの説明.
  • frames — グラフィックユーザーインターフェイスオブジェクトを作成
  • menus — 図にメニューまたはサブメニューを作成する
  • gcf — カレントグラフィックウインドウのハンドルを返す.
  • gdf — デフォルトの図(figure)のハンドルを取得.
  • colordef — Set the color look-and-feel of a given or of all forthcoming graphic figures
  • delete — グラフィックエンティティとその子を削除.
  • close — グラフィックフィギュア,進行バーまたは待機バー,ヘルプブラウザ,xcos,browsevar,またはeditvarを閉じます
  • clc — コマンドウインドウを消去する
  • clear — 変数を消去する

History

バージョン記述
5.5.0 clf now clears frames as well.
6.0.0 clf('reset') no longer resizes nor moves docked figures.
Report an issue
<< anti_aliasing figure_operations colordef >>

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:
Mon Jun 17 17:54:19 CEST 2024