2020-04-01 07:44:32 +00:00
|
|
|
% notcurses_plot(3)
|
|
|
|
% nick black <nickblack@linux.com>
|
2020-04-12 02:00:34 +00:00
|
|
|
% v1.3.0
|
2020-04-01 07:44:32 +00:00
|
|
|
|
|
|
|
# NAME
|
|
|
|
|
2020-04-03 11:47:36 +00:00
|
|
|
notcurses_plot - high level widget for plotting
|
2020-04-01 07:44:32 +00:00
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
|
|
|
**#include <notcurses.h>**
|
|
|
|
|
|
|
|
```c
|
2020-04-03 11:47:36 +00:00
|
|
|
typedef enum {
|
|
|
|
NCPLOT_1x1, // full block █
|
|
|
|
NCPLOT_2x1, // full/lower blocks █▄
|
2020-04-04 17:00:27 +00:00
|
|
|
NCPLOT_1x1x4, // shaded full blocks █▓▒░
|
2020-04-03 11:47:36 +00:00
|
|
|
NCPLOT_4x1, // four vert levels █▆▄▂
|
|
|
|
NCPLOT_8x1, // eight vert levels █▇▆▅▄▃▂▁
|
|
|
|
} ncgridgeom_e;
|
|
|
|
|
2020-04-01 09:05:29 +00:00
|
|
|
typedef struct ncplot_options {
|
2020-04-03 05:05:28 +00:00
|
|
|
// channels for the maximum and minimum levels.
|
|
|
|
// lerp across the domain between these two.
|
2020-04-01 09:05:29 +00:00
|
|
|
uint64_t maxchannel;
|
|
|
|
uint64_t minchannel;
|
2020-04-03 05:05:28 +00:00
|
|
|
// number of "pixels" per row x column
|
|
|
|
ncgridgeom_e gridtype;
|
|
|
|
// independent variable is a contiguous range
|
2020-04-09 01:26:15 +00:00
|
|
|
int rangex;
|
2020-04-04 12:56:31 +00:00
|
|
|
// dependent min and max. set both equal to 0 to
|
|
|
|
// use domain autodiscovery.
|
2020-04-06 06:39:56 +00:00
|
|
|
uint64_t miny, maxy;
|
2020-04-04 13:48:03 +00:00
|
|
|
bool labelaxisd; // label dependent axis
|
|
|
|
bool exponentialy; // is dependent exponential?
|
|
|
|
bool vertical_indep; // vertical independent variable
|
2020-04-01 09:05:29 +00:00
|
|
|
} ncplot_options;
|
2020-04-01 07:44:32 +00:00
|
|
|
```
|
|
|
|
|
2020-04-01 09:05:29 +00:00
|
|
|
**struct ncplot* ncplot_create(struct ncplane* n, const ncplot_options* opts);**
|
|
|
|
|
|
|
|
**struct ncplane* ncplot_plane(struct ncplot* n);**
|
2020-04-01 07:44:32 +00:00
|
|
|
|
2020-04-06 06:39:56 +00:00
|
|
|
**int ncplot_add_sample(struct ncplot* n, uint64_t x, uint64_t y);**
|
|
|
|
**int ncplot_set_sample(struct ncplot* n, uint64_t x, uint64_t y);**
|
2020-04-03 05:05:28 +00:00
|
|
|
|
|
|
|
**void ncplot_destroy(struct ncplot* n);**
|
2020-04-01 07:44:32 +00:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
|
|
|
# NOTES
|
|
|
|
|
2020-04-04 12:56:31 +00:00
|
|
|
Neither **exponentialy** not **vertical_indep** is yet implemented.
|
2020-04-03 11:47:36 +00:00
|
|
|
|
2020-04-01 07:44:32 +00:00
|
|
|
# RETURN VALUES
|
|
|
|
|
2020-04-04 12:56:31 +00:00
|
|
|
**ncplot_create** 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.
|
2020-04-03 05:16:16 +00:00
|
|
|
|
2020-04-01 09:05:29 +00:00
|
|
|
**ncplot_plane** returns the **ncplane** on which the plot is drawn. It cannot
|
|
|
|
fail.
|
|
|
|
|
2020-04-01 07:44:32 +00:00
|
|
|
# SEE ALSO
|
|
|
|
|
|
|
|
**notcurses(3)**,
|
|
|
|
**notcurses_ncplane(3)**
|