|
NAMEnotcurses_plot - high level widget for plottingSYNOPSIS#include <notcurses/notcurses.h>
struct ncuplot* ncuplot_create(struct ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy); struct ncdplot* ncdplot_create(struct ncplane* n, const ncplot_options* opts, double miny, double maxy); struct ncplane* ncuplot_plane(struct ncuplot* n); struct ncplane* ncdplot_plane(struct ncdplot* n); int ncuplot_add_sample(struct ncuplot* n, uint64_t x, uint64_t y); int ncdplot_add_sample(struct ncdplot* n, uint64_t x, double y); int ncuplot_set_sample(struct ncuplot* n, uint64_t x, uint64_t y); int ncdplot_set_sample(struct ncdplot* n, uint64_t x, double y); int ncuplot_sample(const struct ncuplot* n, uint64_t x, uint64_t* y); int ncdplot_sample(const struct ncdplot* n, uint64_t x, double* y); void ncuplot_destroy(struct ncuplot* n); void ncdplot_destroy(struct ncdplot* n); DESCRIPTIONThese functions support histograms. The independent variable is always an uint64_t. The samples are either uint64_ts (ncuplot) or doubles (ncdplot). Only a window over the samples is retained at any given time, and this window can only move towards larger values of the independent variable. The window is moved forward whenever an x larger than the current window's maximum is supplied to add_sample or set_sample.add_sample increments the current value corresponding to this x by y. set_sample replaces the current value corresponding to this x. If rangex is 0, or larger than the bound plane will support, it is capped to the available space. The domain can either be specified as miny and maxy, or domain autodetection can be invoked via setting both to 0. If the domain is specified, samples outside the domain are an error, and do not contribute to the plot. Supplying an x below the current window is an error, and has no effect. More granular block glyphs means more resolution in your plots, but they can be difficult to differentiate at small text sizes. Sextants and Braille allow for more resolution on the independent variable. It can be difficult to predict how the Braille glyphs will look in a given font. The same ncplot_options struct can be used with all ncplot types. The flags field is a bitmask composed of:
If NCPLOT_OPTION_LABELTICKSD or NCPLOT_OPTION_PRINTSAMPLE is supplied, the legendstyle field will be used to style the labels. It is otherwise ignored. The label is printed in the upper left, immediately to the right of the topmost axis tick (if NCPLOT_OPTION_LABELTICKSD was used). The most recent sample is printed opposite from the label along the independent axis (if NCPLOT_OPTION_PRINTSAMPLE was used). NOTESNCPLOT_OPTION_VERTICALI is not yet implemented.RETURN VALUEScreate will return an error if miny equals maxy, but they are non-zero. It will also return an error if maxy < miny. An invalid gridtype will result in an error.plane returns the ncplane on which the plot is drawn. It cannot fail. SEE ALSOnotcurses(3), notcurses_plane(3), notcurses_visual(3)AUTHORSnick black <nickblack@linux.com>.
Visit the GSP FreeBSD Man Page Interface. |