Skip to main content
`Ctrl`+`K`

# PetscDrawHGAddWeightedValue

Adds another value to the histogram with a weight.

## Synopsis

    #include "petscdraw.h"
    #include "petscsys.h"
    #include "petscviewer.h"
    PetscErrorCode PetscDrawHGAddWeightedValue(PetscDrawHG hist, PetscReal value, PetscReal weight)

Logically Collective

## Input Parameters

- hist - The histogram

- value - The value

- weight - The value weight

## Notes

Calls to this function are used to create a histogram with non-integer bin heights. Use calls to `PetscDrawHGAddValue()` to create a standard histogram with integer bin heights.

This allows us to histogram frequency and probability distributions (https://learnche.org/pid/univariate-review/histograms-and-probability-distributions). We can use this to look at particle weight distributions in Particle-in-Cell (PIC) methods, for example.

## See Also

`PetscDrawHGCreate()`, `PetscDrawHG`, `PetscDrawHGDraw()`, `PetscDrawHGReset()`, `PetscDrawHGAddValue()`

## Level

intermediate

## Location

src/sys/classes/draw/utils/hists.c

Index of all Draw routines
Table of Contents for all manual pages
Index of all manual pages