KDATA_HIST_ALLOC(3) Library Functions Manual KDATA_HIST_ALLOC(3)

NAME

kdata_hist_allocallocate histogram data for plotting

LIBRARY

library “libkplot”

SYNOPSIS

#include <cairo.h>
#include <kplot.h>
struct kdata *
kdata_hist_alloc(double rmin, double rmax, size_t bins);

DESCRIPTION

The kdata_hist_alloc function creates a reference-counted data sources for kplot(3). The histogram is initialised with x-values set to the bucket minimum and y-values set to zero. It uses a histogram data model: the data array is laid out in uniformly-spaced buckets of size (rmax - rmin) / bins, with a given value x falling into bucket [i / bins * (rmax - rmin) <= x < (i + 1) / bins * (rmax - rmin)]. Bucket values are modified with kdata_hist_add(3) and kdata_hist_set(3).

RETURN VALUES

kdata_hist_alloc returns NULL if memory allocation failed.

SEE ALSO

kdata_hist_add(3), kplot(3)
February 7, 2015 OpenBSD 5.8