Library Functions Manual
NAME kplot_attach_smooth — assign smoothed plot data to plotting context
LIBRARY library “libkplot”
SYNOPSIS #include <cairo.h>
(const struct kplot *p
, struct kdata *d
, enum kplottype t
, const struct kdatacfg *cfg
, enum ksmthtype smthtype
, const struct ksmthcfg *smth
function assigns a smoothed data source d
to a plotting context p
, reference-counting the data source in the process. See kplot_attach_data(3)
for details on the p
, and cfg
parameters. The remaining smthtype
configure smoothing options, which manipulate the data as it's being drawn. The following smoothing types are available:
Replace each point with the average of the surrounding movsamples points. If movsamples if not an odd number, it is increased by one. If the point is not surrounded completely by movsamples, say by being at the initial or trailing points of the data set, or the points surrounding are not valid numbers, then the point is not averaged.
Compute the empirical CDF from all valid points of the set. This will normalise the y-values to within the unit interval.
Normalise the y-values as probabilities of valid points of the set.
RETURN VALUES kplot_attach_smooth returns 0 if allocation of internal structures fails due to memory exhaustion. In this case, all allocations and references will be dropped.
CAVEATS The KSMOOTH_CDF an KSMOOTH_PMF has undefined behaviour for negative probabilities.