# PetscDrawViewPortsCreateRect
Splits a window into smaller view ports. Each processor shares all the viewports. The number of views in the x- and y-directions is specified. 
## Synopsis
```
#include "petscdraw.h" 
PetscErrorCode PetscDrawViewPortsCreateRect(PetscDraw draw, PetscInt nx, PetscInt ny, PetscDrawViewPorts **newports)
```
Collective on draw


## Input Parameters

- ***draw -*** the drawing context
- ***nx -*** the number of x divisions
- ***ny -*** the number of y divisions



## Output Parameter

- ***ports -*** a `PetscDrawViewPorts` context (C structure)





## See Also
 `PetscDrawSplitViewPort()`, `PetscDrawSetViewPort()`, `PetscDrawViewPortsSet()`, `PetscDrawViewPortsDestroy()`, `PetscDrawViewPorts`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/interface/dviewp.c.html#PetscDrawViewPortsCreateRect">src/sys/classes/draw/interface/dviewp.c</A>


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


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