# PetscViewerSetFormat
Sets the format for a `PetscViewer`. 
## Synopsis
```
#include "petscsys.h" 
PetscErrorCode PetscViewerSetFormat(PetscViewer viewer, PetscViewerFormat format)
```
Logically Collective

This routine is deprecated, you should use `PetscViewerPushFormat()`/`PetscViewerPopFormat()`


## Input Parameters

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





## Notes
Available formats include

- ***`PETSC_VIEWER_DEFAULT` -*** default format
- ***`PETSC_VIEWER_ASCII_MATLAB` -*** MATLAB format
- ***`PETSC_VIEWER_ASCII_DENSE` -*** print matrix as dense
- ***`PETSC_VIEWER_ASCII_IMPL` -*** implementation-specific format
(which is in many cases the same as the default)
- ***`PETSC_VIEWER_ASCII_INFO` -*** basic information about object
- ***`PETSC_VIEWER_ASCII_INFO_DETAIL` -*** more detailed info
about object
- ***`PETSC_VIEWER_ASCII_COMMON` -*** identical output format for
all objects of a particular type
- ***`PETSC_VIEWER_ASCII_INDEX` -*** (for vectors) prints the vector
element number next to each vector entry
- ***`PETSC_VIEWER_ASCII_SYMMODU` -*** print parallel vectors without
indicating the processor ranges
- ***`PETSC_VIEWER_ASCII_VTK` -*** outputs the object to a VTK file (deprecated since v3.14)
- ***`PETSC_VIEWER_NATIVE` -*** store the object to the binary
file in its native format (for example, dense
matrices are stored as dense), `DMDA` vectors are dumped directly to the
file instead of being first put in the natural ordering
- ***`PETSC_VIEWER_DRAW_BASIC` -*** views the vector with a simple 1d plot
- ***`PETSC_VIEWER_DRAW_LG` -*** views the vector with a line graph
- ***`PETSC_VIEWER_DRAW_CONTOUR` -*** views the vector with a contour plot


These formats are most often used for viewing matrices and vectors.

If a format (for example `PETSC_VIEWER_DRAW_CONTOUR`) was applied to a viewer
where it didn't apply (`PETSC_VIEWER_STDOUT_WORLD`) it cause the default behavior
for that viewer to be used.


## Note
This supports passing in a NULL for the viewer for use in the debugger, but it should never be called in the code with a NULL viewer


## See Also
 [](sec_viewers), `PetscViewerGetFormat()`, `PetscViewerASCIIOpen()`, `PetscViewerBinaryOpen()`, `MatView()`, `VecView()`, `PetscViewerType`,
`PetscViewerPushFormat()`, `PetscViewerPopFormat()`, `PetscViewerDrawOpen()`, `PetscViewerSocketOpen()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/interface/viewa.c.html#PetscViewerSetFormat">src/sys/classes/viewer/interface/viewa.c</A>


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


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