**[G-2] graph drop** -- Drop graphs from memory

__Syntax__

Drop named graphs from memory

__gr__**aph** **drop** *name* [*name* ...]

Drop all graphs from memory

__gr__**aph** **drop** **_all**

*name* is the name of a graph currently in memory or the partial name of a
graph in memory with the **?** and ***** wildcard characters.

__Menu__

**Graphics > Manage graphs > Drop graphs**

__Description__

**graph drop** *name* drops (discards) the specified graphs from memory and
closes any associated Graph windows.

**graph** **drop** **_all** drops all graphs from memory and closes all associated
Graph windows.

__Remarks__

See **[G-2] graph manipulation** for an introduction to the graph
manipulation commands.

Remarks are presented under the following headings:

Typical use
Relationship between graph drop _all and discard
Erasing graphs on disk

__Typical use__

Graphs contain the data they display, so when datasets are large, graphs
can consume much memory. **graph** **drop** frees that memory. **Graph** is the
name of a graph when you do not specify otherwise.

**. graph twoway scatter faminc educ, ms(p)**

**.** ...

**. graph drop Graph**

We often use graphs in memory to prepare the pieces for **graph** **combine**:

**. graph** ... **,** ... **name(p1)**

**. graph** ... **,** ... **name(p2)**

**. graph** ... **,** ... **name(p3)**

**. graph combine p1 p2 p3,** ... **saving(result, replace)**

**. graph drop _all**

__Relationship between graph drop _all and discard__

The **discard** command performs **graph** **drop** **_all** and more:

1. **discard** eliminates prior estimation results and automatically
loaded programs and thereby frees even more memory.

2. **discard** closes any open dialog boxes and thereby frees even more
memory.

We nearly always type **discard** in preference to **graph** **drop** **_all** if only
because **discard** has fewer characters. The exception to that is when we
have fit a model and still plan on redisplaying prior results, performing
tests on that model, or referring to **_b[]**, **_se[]**, etc.

See **[P] discard** for a description of the **discard** command.

__Erasing graphs on disk__

**graph** **drop** is not used to erase **.gph** files; instead, use Stata's standard
**erase** command:

**. erase matfile.gph**