:orphan:
# PetscViewerDrawOpen
Opens a `PetscDraw` window for use as a `PetscViewer` with type `PETSCVIEWERDRAW`. If you want to do graphics in this window, you must call `PetscViewerDrawGetDraw()` and perform the graphics on the `PetscDraw` object. 
## Synopsis
```
#include "petscdraw.h" 
#include "petscviewer.h" 
PetscErrorCode PetscViewerDrawOpen(MPI_Comm comm, const char display[], const char title[], int x, int y, int w, int h, PetscViewer *viewer)
```
Collective


## Input Parameters

- ***comm -*** communicator that will share window
- ***display -*** the X display on which to open, or `NULL` for the local machine
- ***title -*** the title to put in the title bar, or `NULL` for no title
- ***x -*** horizontal screen coordinate of the upper left corner of window, or use `PETSC_DECIDE`
- ***y -*** vertical screen coordinate of the upper left corner of window, or use `PETSC_DECIDE`
- ***w -*** window width in pixels, or may use `PETSC_DECIDE` or `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_HALF_SIZE`,`PETSC_DRAW_THIRD_SIZE`, `PETSC_DRAW_QUARTER_SIZE`
- ***h -*** window height in pixels, or may use `PETSC_DECIDE` or `PETSC_DRAW_FULL_SIZE`, `PETSC_DRAW_HALF_SIZE`,`PETSC_DRAW_THIRD_SIZE`, `PETSC_DRAW_QUARTER_SIZE`



## Output Parameter

- ***viewer -*** the `PetscViewer`



## Format Options

- ***`PETSC_VIEWER_DRAW_BASIC` -*** displays with basic format
- ***`PETSC_VIEWER_DRAW_LG`    -*** displays using a line graph



## Options Database Keys

- ***-draw_type -*** use x or null
- ***-nox -*** Disables all x-windows output
- ***-display <name> -*** Specifies name of machine for the X display
- ***-geometry <x,y,w,h> -*** allows setting the window location and size
- ***-draw_pause <pause> -*** Sets time (in seconds) that the
program pauses after PetscDrawPause() has been called
(0 is default, -1 implies until user input).





## Fortran Note
Whenever indicating null character data in a Fortran code,
`PETSC_NULL_CHARACTER` must be employed; using NULL is not
correct for character data!  Thus, `PETSC_NULL_CHARACTER` can be
used for the display and title input parameters.


## See Also
 [](sec_viewers), `PETSCVIEWERDRAW`, `PetscDrawCreate()`, `PetscViewerDestroy()`, `PetscViewerDrawGetDraw()`, `PetscViewerCreate()`, `PETSC_VIEWER_DRAW_`,
`PETSC_VIEWER_DRAW_WORLD`, `PETSC_VIEWER_DRAW_SELF`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/draw/drawv.c.html#PetscViewerDrawOpen">src/sys/classes/viewer/impls/draw/drawv.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex1.c.html">src/dm/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex2.c.html">src/dm/tutorials/ex2.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/tutorials/ex5.c.html">src/dm/tutorials/ex5.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex2.c.html">src/snes/tutorials/ex2.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex21.c.html">src/snes/tutorials/ex21.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex22.c.html">src/snes/tutorials/ex22.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex3.c.html">src/snes/tutorials/ex3.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex2.c.html">src/ts/tutorials/ex2.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex21.c.html">src/ts/tutorials/ex21.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex3.c.html">src/ts/tutorials/ex3.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex4.c.html">src/ts/tutorials/ex4.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/impls/draw/drawv.c)


[Index of all Viewer routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
