plotspec

plotspec —

Synopsis

#define             GP_MAXFORMULA
#define             GP_BORDER_DEFAULT
#define             LT_AUTO
enum                GpLineStyle;
enum                GpKeyPos;
typedef             gp_style_spec;
enum                gp_line_flags;
                    GPT_LINE;
#define             PLOT_LABEL_TEXT_LEN
enum                gp_just_codes;
                    GPT_LABEL;
                    GPT_SPEC;
GPT_SPEC *          plotspec_new                        (void);
void                plotspec_destroy                    (GPT_SPEC *spec);
void                plotspec_label_init                 (GPT_LABEL *lbl);
int                 plotspec_add_line                   (GPT_SPEC *spec);
int                 plotspec_delete_line                (GPT_SPEC *spec,
                                                         int i);
GPT_LINE *          plotspec_clone_lines                (GPT_SPEC *spec,
                                                         int *err);
int                 plotspec_max_line_width             (GPT_SPEC *spec);
int                 plotspec_add_label                  (GPT_SPEC *spec);
int                 plotspec_delete_label               (GPT_SPEC *spec,
                                                         int i);
GPT_LABEL *         plotspec_clone_labels               (GPT_SPEC *spec,
                                                         int *err);
int                 plotspec_print                      (const GPT_SPEC *spec,
                                                         FILE *fp);
int                 plotspec_add_fit                    (GPT_SPEC *spec,
                                                         FitType f);
void                print_auto_fit_string               (FitType fit,
                                                         FILE *fp);
const char *        gp_line_style_string                (int t);
int                 gp_style_from_string                (const char *s);
int                 gp_style_from_translation           (const char *s);
gp_style_spec *     get_style_spec                      (int t);
int                 gp_keypos_from_string               (const char *s);
int                 gp_keypos_from_translation          (const char *s);
gp_style_spec *     get_keypos_spec                     (int t);
void                print_keypos_string                 (int t,
                                                         FILE *fp);
void                set_plotfit_line                    (char *title,
                                                         char *formula,
                                                         FitType f,
                                                         const double *b,
                                                         double x0,
                                                         double pd);

Description

Details

GP_MAXFORMULA

#define GP_MAXFORMULA 128


GP_BORDER_DEFAULT

#define GP_BORDER_DEFAULT (-1)


LT_AUTO

#define LT_AUTO (-2)


enum GpLineStyle

typedef enum {
    GP_STYLE_NONE,
    GP_STYLE_LINES,
    GP_STYLE_POINTS,
    GP_STYLE_LINESPOINTS,
    GP_STYLE_IMPULSES,
    GP_STYLE_DOTS,
    GP_STYLE_STEPS,
    GP_STYLE_BOXES,
    GP_STYLE_ERRORBARS,
    GP_STYLE_FILLEDCURVE,
    GP_STYLE_CANDLESTICKS
} GpLineStyle;


enum GpKeyPos

typedef enum {
    GP_KEY_LEFT_TOP,
    GP_KEY_RIGHT_TOP,
    GP_KEY_LEFT_BOTTOM,
    GP_KEY_RIGHT_BOTTOM,
    GP_KEY_OUTSIDE,
    GP_KEY_NONE
} GpKeyPos;


gp_style_spec

typedef struct gp_style_spec_ gp_style_spec;


enum gp_line_flags

typedef enum {
    GP_LINE_USER    = 1 << 0,
    GP_LINE_BOXDATA = 1 << 1
} gp_line_flags;


GPT_LINE

typedef struct {
    int varnum;                    /* ID number of variable to plot */
    int style;                     /* lines, points, etc. */
    char title[MAXTITLE];          /* key or legend title */
    char formula[GP_MAXFORMULA];   /* expression to plot (rather than data) */
    double scale;                  /* scale factor for data */
    char rgb[8];                   /* rgb color specification */
    char yaxis;                    /* 1 for left, 2 for right */
    int type;                      /* 1, 2, ... (style) */
    int ptype;                     /* point type */
    int width;                     /* default 1, could be bigger */
    char ncols;                    /* number of data columns (0 for formula) */
    float whiskwidth;              /* whiskerbar width (boxplots) */
    char flags;                    /* additional options */
} GPT_LINE;


PLOT_LABEL_TEXT_LEN

#define PLOT_LABEL_TEXT_LEN 31


enum gp_just_codes

typedef enum {
    GP_JUST_LEFT,
    GP_JUST_CENTER,
    GP_JUST_RIGHT
} gp_just_codes;


GPT_LABEL

typedef struct {
    char text[PLOT_LABEL_TEXT_LEN + 1]; 
    double pos[2];
    int just;
} GPT_LABEL;


GPT_SPEC

typedef struct {
    FILE *fp;
    char fname[MAXLEN];        /* for gui purposes */
    PlotType code;             /* to deal with FREQ, FCASTERR... */
    GptFlags flags;            /* bitwise OR of options */
    FitType fit;               /* type of fitted line shown */
    int nobs;                  /* number of observations */
    int okobs;                 /* number of fully valid observations */
    int pd;                    /* frequency (time series data) */
    char xvarname[MAXDISP];    /* name of x variable */
    char yvarname[MAXDISP];    /* name of y variable */
    char titles[4][MAXTITLE];  /* main, x, y, y2 */
    double range[4][2];        /* axis range specifiers */
    double logbase[3];         /* axis log-scales base (0 for linear) */
    int keyspec;               /* position of key (or none) */
    char xfmt[16];             /* x-axis tic format */
    char xtics[64];            /* x-axis tic marks */
    char mxtics[4];            /* minor tics */
    char yfmt[16];             /* y-axis tic format */             
    int termtype;              /* gnuplot "terminal" code */
    int n_lines;               /* number of lines */
    int samples;               /* number of samples for parametric plots */
    int border;                /* gnuplot border code */
    int bmargin;               /* bottom margin */
    float boxwidth;            /* when using box style for frequency plots */
    GPT_LINE *lines;           /* details on individual lines */
    char **literal;            /* additional commands */
    int n_literal;             /* number of the above */
    double *data;              /* data to plot */
    char **markers;            /* data-point markers (not always present) */
    int n_markers;             /* number of such markers */
    GPT_LABEL *labels;         /* textual labels written onto graph */
    int n_labels;              /* number of the above */
    int *reglist;              /* regression list for X-Y plot with fitted line */
    gretl_matrix *b_ols;       /* coeffs for linear fit */
    gretl_matrix *b_quad;      /* coeffs for quadratic fit */
    gretl_matrix *b_inv;       /* coeffs for inverse fit */
    char *labeled;             /* for GUI use */
    void *ptr;                 /* for GUI use */
} GPT_SPEC;


plotspec_new ()

GPT_SPEC *          plotspec_new                        (void);

Returns :

plotspec_destroy ()

void                plotspec_destroy                    (GPT_SPEC *spec);

spec :

plotspec_label_init ()

void                plotspec_label_init                 (GPT_LABEL *lbl);

lbl :

plotspec_add_line ()

int                 plotspec_add_line                   (GPT_SPEC *spec);

spec :
Returns :

plotspec_delete_line ()

int                 plotspec_delete_line                (GPT_SPEC *spec,
                                                         int i);

spec :
i :
Returns :

plotspec_clone_lines ()

GPT_LINE *          plotspec_clone_lines                (GPT_SPEC *spec,
                                                         int *err);

spec :
err :
Returns :

plotspec_max_line_width ()

int                 plotspec_max_line_width             (GPT_SPEC *spec);

spec :
Returns :

plotspec_add_label ()

int                 plotspec_add_label                  (GPT_SPEC *spec);

spec :
Returns :

plotspec_delete_label ()

int                 plotspec_delete_label               (GPT_SPEC *spec,
                                                         int i);

spec :
i :
Returns :

plotspec_clone_labels ()

GPT_LABEL *         plotspec_clone_labels               (GPT_SPEC *spec,
                                                         int *err);

spec :
err :
Returns :

plotspec_print ()

int                 plotspec_print                      (const GPT_SPEC *spec,
                                                         FILE *fp);

spec :
fp :
Returns :

plotspec_add_fit ()

int                 plotspec_add_fit                    (GPT_SPEC *spec,
                                                         FitType f);

spec :
f :
Returns :

print_auto_fit_string ()

void                print_auto_fit_string               (FitType fit,
                                                         FILE *fp);

fit :
fp :

gp_line_style_string ()

const char *        gp_line_style_string                (int t);

t :
Returns :

gp_style_from_string ()

int                 gp_style_from_string                (const char *s);

s :
Returns :

gp_style_from_translation ()

int                 gp_style_from_translation           (const char *s);

s :
Returns :

get_style_spec ()

gp_style_spec *     get_style_spec                      (int t);

t :
Returns :

gp_keypos_from_string ()

int                 gp_keypos_from_string               (const char *s);

s :
Returns :

gp_keypos_from_translation ()

int                 gp_keypos_from_translation          (const char *s);

s :
Returns :

get_keypos_spec ()

gp_style_spec *     get_keypos_spec                     (int t);

t :
Returns :

print_keypos_string ()

void                print_keypos_string                 (int t,
                                                         FILE *fp);

t :
fp :

set_plotfit_line ()

void                set_plotfit_line                    (char *title,
                                                         char *formula,
                                                         FitType f,
                                                         const double *b,
                                                         double x0,
                                                         double pd);

title :
formula :
f :
b :
x0 :
pd :