# PetscDrawBarSetData
ogically Collective 
## Synopsis
```
#include "petscdraw.h" 
#include "petscviewer.h" 
PetscErrorCode PetscDrawBarSetData(PetscDrawBar bar, PetscInt bins, const PetscReal data[], const char *const *labels)
```

## Input Parameters

- ***bar -*** The bar graph context.
- ***bins  -*** number of items
- ***values -*** values of each item
- ***labels -*** optional label for each bar, NULL terminated array of strings





## Notes
Call `PetscDrawBarDraw()` after this call to display the new plot

The data is ignored on all ranks except zero


## See Also
 `PetscDrawBar`, `PetscDrawBarCreate()`, `PetscDrawBar`, `PetscDrawBarDraw()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/utils/bars.c.html#PetscDrawBarSetData">src/sys/classes/draw/utils/bars.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/draw/utils/bars.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)  
