Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes


top cgErase


cgErase [, background_color] [, COLOR=string/integer/long] [, LAYOUT=intarr(3)] [, /WINDOW]

Provides a device-independent and color-model-independent way to erase a graphics window with a particular color.


background_color in optional type=string/integer/long default=white

The color to use in erasing the graphics window. Default is "white." Color names are those used with cgColor.


COLOR in optional type=string/integer/long default=white

An alternative way to specify the color to use in erasing the graphics window. Color names are those used with cgColor. This parameter is used in preference to the background_color parameter.

LAYOUT in optional type=intarr(3)

This keyword specifies a grid with a graphics window and determines where the graphic should appear. The syntax of LAYOUT is three numbers: [ncolumns, nrows, location]. The grid is determined by the number of columns (ncolumns) by the number of rows (nrows). The location of the graphic is determined by the third number. The grid numbering starts in the upper left (1) and goes sequentually by column and then by row. If this keyword is used, only this portion of the window is erased.

WINDOW in optional type=boolean default=0

Set this keyword to erase the current cgWindow application. "Erasing" in this case means removing all the current commands.


Used to "erase" various things:

IDL> cgErase IDL> cgErase, 'gray' IDL> cgErase, COLOR='charcoal' IDL> cgPlot, cgDemoData(1), /Window IDL> cgErase, /Window IDL> cgPlot, cgDemoData(17), Layout=[2,2,1] IDL> cgPlot, cgDemoData(17), Layout=[2,2,4] IDL> cgErase, Layout=[2,2,1]

Author information



David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: Coyote's Guide to IDL Programming:


Copyright (c) 2010, Fanning Software Consulting, Inc.


Change History:

Written, 12 November 2010. DWF. Modified so that input variables are not changed. 18 Nov 2010. DWF. Got my color selection algorithm right. COLOR keyword takes precedence over the parameter. 18 Nov 2010. DWF. Modified to erase in decomposed color, if possible. In some cases, I was turning BYTE values to strings without converting to INTEGERS first. 30 Dec 2010. DWF. Added WINDOW keyword. 26 Jan 2011. DWF. Added LAYOUT keyword. 1 Feb 2011. DWF. Modified error handler to restore the entry decomposition state if there is an error. 17 March 2011. DWF

File attributes

Modification date: Fri Mar 27 11:07:38 2015
Lines: 171
Docformat: rst rst