graphing

graphing

Functions

#define BOXCOLOR
#define SHADECOLOR
#define maybe_big_multiplot()
#define frequency_plot_code()
#define set_png_output()
#define get_png_output()
#define unset_png_output()
const char * get_gretl_png_term_line ()
const char * get_png_line_for_plotspec ()
const char * get_gretl_emf_term_line ()
const char * get_gretl_pdf_term_line ()
const char * get_gretl_eps_term_line ()
const char * gp_justification_string ()
int split_graph_fontspec ()
void gnuplot_missval_string ()
FILE * open_plot_input_file ()
int finalize_plot_input_file ()
int gnuplot_graph_wanted ()
void gnuplot_cleanup ()
int specified_gp_output_format ()
void write_plot_output_line ()
int write_plot_type_string ()
void write_plot_line_styles ()
void write_plot_bounding_box_request ()
PlotType plot_type_from_string ()
void plot_get_scaled_dimensions ()
int graph_written_to_file ()
void reset_plot_count ()
int matrix_plot ()
int gnuplot ()
int multi_scatters ()
int matrix_scatters ()
int gnuplot_3d ()
int plot_freq ()
int garch_resid_plot ()
int rmplot ()
int hurstplot ()
int qq_plot ()
int correlogram_plot ()
int periodogram_plot ()
int theil_forecast_plot ()
int gretl_panel_ts_plot ()
int plot_fcast_errs ()
int plot_simple_fcast_bands ()
int plot_tau_sequence ()
int gretl_VAR_plot_impulse_response ()
int gretl_VAR_plot_FEVD ()
int gretl_VAR_plot_multiple_irf ()
int gretl_VECM_combined_EC_plot ()
int gretl_system_residual_plot ()
int gretl_system_residual_mplot ()
int gretl_VAR_roots_plot ()
int confidence_ellipse_plot ()
int xy_plot_with_control ()
int gnuplot_process_file ()
void print_gnuplot_literal_lines ()
int is_auto_fit_string ()
int gnuplot_has_ttf ()
int gnuplot_pdf_terminal ()
int gnuplot_eps_terminal ()
int gnuplot_png_terminal ()
int gnuplot_has_cp950 ()
void set_graph_palette ()
void set_graph_palette_from_string ()
void graph_palette_reset ()
void print_rgb_hash ()
void gretl_rgb_get ()
void print_palette_string ()
const gretlRGB * get_graph_color ()
int gnuplot_test_command ()
void gnuplot_png_set_use_aa ()
void gnuplot_png_set_default_scale ()
void date_from_gnuplot_time ()
double gnuplot_time_from_date ()
double gnuplot_version ()
int gnuplot_has_wxt ()

Types and Values

enum GptFlags
typedef gretlRGB
typedef GPT_SPEC
#define MAXTITLE
#define N_GP_COLORS
#define GP_WIDTH
#define GP_HEIGHT
#define GP_LB_WIDTH
#define GP_LB_HEIGHT
#define GP_XL_WIDTH
#define GP_XL_HEIGHT
#define GP_XXL_WIDTH
#define GP_XXL_HEIGHT
#define GP_SQ_SIZE
enum PlotType
enum FitType
enum TermType
enum PNGTerm
enum PDFTerm
enum EPSTerm

Object Hierarchy


Description

Functions

BOXCOLOR

#define BOXCOLOR (N_GP_COLORS - 2)


SHADECOLOR

#define SHADECOLOR (N_GP_COLORS - 1)


maybe_big_multiplot()

#define             maybe_big_multiplot(c)


frequency_plot_code()

#define             frequency_plot_code(c)


set_png_output()

#define set_png_output(p) (p->flags |= GPT_PNG_OUTPUT)


get_png_output()

#define get_png_output(p) (p->flags & GPT_PNG_OUTPUT)


unset_png_output()

#define unset_png_output(p) (p->flags &= ~GPT_PNG_OUTPUT) 


get_gretl_png_term_line ()

const char *
get_gretl_png_term_line (PlotType ptype,
                         GptFlags flags);

Constructs a suitable line for sending to gnuplot to invoke the PNG "terminal". Checks the environment for setting of GRETL_PNG_GRAPH_FONT. Also appends a color-specification string if the gnuplot PNG driver supports this.

Parameters

ptype

indication of the sort of plot to be made, which may made a difference to the color palette chosen.

 

flags

plot option flags.

 

Returns

the terminal string, "set term png ..."


get_png_line_for_plotspec ()

const char *
get_png_line_for_plotspec (const GPT_SPEC *spec);

Returns


get_gretl_emf_term_line ()

const char *
get_gretl_emf_term_line (PlotType ptype,
                         int color);

Constructs a suitable line for sending to gnuplot to invoke the EMF "terminal".

Parameters

ptype

indication of the sort of plot to be made.

 

color

1 if graph is to be in color, else 0.

 

Returns

the term string, "set term emf ..."


get_gretl_pdf_term_line ()

const char *
get_gretl_pdf_term_line (PlotType ptype,
                         GptFlags flags);

Returns


get_gretl_eps_term_line ()

const char *
get_gretl_eps_term_line (PlotType ptype,
                         GptFlags flags);

Returns


gp_justification_string ()

const char *
gp_justification_string (int j);

Returns


split_graph_fontspec ()

int
split_graph_fontspec (const char *s,
                      char *name,
                      int *psz);

Returns


gnuplot_missval_string ()

void
gnuplot_missval_string (FILE *fp);


open_plot_input_file ()

FILE *
open_plot_input_file (PlotType ptype,
                      int *err);

Opens a file into which gnuplot commands will be written. Depending on the prospective use of the stream, some header-type material may be written into it (the primary case being when we're going to produce PNG output for display in the gretl GUI). The prospective use is figured out based on the program state and ptype .

Parameters

ptype

indication of the sort of plot to be made.

 

err

location to receive error code.

 

Returns

writable stream on success, NULL on failure.


finalize_plot_input_file ()

int
finalize_plot_input_file (FILE *fp);

Closes fp and attempts to "make" the graph that it specifies.

Parameters

fp

stream to which gnuplot commands have been written.

 

Returns

0 on success, non-zero code on error.


gnuplot_graph_wanted ()

int
gnuplot_graph_wanted (PlotType ptype,
                      gretlopt opt);

Returns


gnuplot_cleanup ()

void
gnuplot_cleanup (void);

Removes any temporary gnuplot input file written in the user's dot directory.


specified_gp_output_format ()

int
specified_gp_output_format (void);

Returns


write_plot_output_line ()

void
write_plot_output_line (const char *path,
                        FILE *fp);


write_plot_type_string ()

int
write_plot_type_string (PlotType ptype,
                        GptFlags flags,
                        FILE *fp);

Returns


write_plot_line_styles ()

void
write_plot_line_styles (int ptype,
                        FILE *fp);


write_plot_bounding_box_request ()

void
write_plot_bounding_box_request (FILE *fp);


plot_type_from_string ()

PlotType
plot_type_from_string (const char *str);

Parameters

str

initial comment line from plot file.

 

Returns

the special plot code corresponding to the initial comment string in the plot file, or PLOT_REGULAR if no special comment is recognized.


plot_get_scaled_dimensions ()

void
plot_get_scaled_dimensions (int *width,
                            int *height,
                            double scale);


graph_written_to_file ()

int
graph_written_to_file (void);

Returns


reset_plot_count ()

void
reset_plot_count (void);


matrix_plot ()

int
matrix_plot (gretl_matrix *m,
             const int *list,
             const char *literal,
             gretlopt opt);

Returns


gnuplot ()

int
gnuplot (const int *plotlist,
         const char *literal,
         const DATASET *dset,
         gretlopt opt);

Writes a gnuplot plot file to display the values of the variables in list and calls gnuplot to make the graph.

Parameters

plotlist

list of variables to plot, by ID number.

 

literal

commands to be passed to gnuplot.

 

dset

dataset struct.

 

opt

option flags.

 

Returns

0 on successful completion, non-zero code on error.


multi_scatters ()

int
multi_scatters (const int *list,
                const DATASET *dset,
                gretlopt opt);

Writes a gnuplot plot file to display up to 16 small graphs based on the variables in list , and calls gnuplot to make the graph.

Parameters

list

list of variables to plot, by ID number.

 

dset

dataset struct.

 

opt

can include OPT_L to use lines, OPT_U to direct output to a named file.

 

Returns

0 on successful completion, error code on error.


matrix_scatters ()

int
matrix_scatters (const gretl_matrix *m,
                 const int *list,
                 const DATASET *dset,
                 gretlopt opt);

Writes a gnuplot plot file to display up to 16 small graphs based on the data in m , and calls gnuplot to make the graph.

Parameters

m

matrix containing data to plot.

 

list

list of columns to plot, or NULL.

 

dset

dataset pointer, or NULL.

 

opt

can include OPT_L to use lines, OPT_U to direct output to a named file.

 

Returns

0 on successful completion, error code on error.


gnuplot_3d ()

int
gnuplot_3d (int *list,
            const char *literal,
            DATASET *dset,
            gretlopt opt);

Writes a gnuplot plot file to display a 3D plot (Z on the vertical axis, X and Y on base plane).

Parameters

list

list of variables to plot, by ID number: Y, X, Z

 

literal

literal command(s) to pass to gnuplot (or NULL)

 

dset

pointer to dataset.

 

opt

may include OPT_F to force display of fitted surface.

 

Returns

0 on successful completion, error code on error.


plot_freq ()

int
plot_freq (FreqDist *freq,
           DistCode dist);

Plot the actual frequency distribution for a variable versus a theoretical distribution: Gaussian, gamma or none.

Parameters

freq

pointer to frequency distribution struct.

 

dist

probability distribution code.

 

Returns

0 on successful completion, error code on error.


garch_resid_plot ()

int
garch_resid_plot (const MODEL *pmod,
                  const DATASET *dset);

Returns


rmplot ()

int
rmplot (const int *list,
        DATASET *dset,
        gretlopt opt,
        PRN *prn);

Returns


hurstplot ()

int
hurstplot (const int *list,
           DATASET *dset,
           gretlopt opt,
           PRN *prn);

Returns


qq_plot ()

int
qq_plot (const int *list,
         const DATASET *dset,
         gretlopt opt);

Returns


correlogram_plot ()

int
correlogram_plot (const char *vname,
                  const double *acf,
                  const double *pacf,
                  int m,
                  double pm,
                  gretlopt opt);

Returns


periodogram_plot ()

int
periodogram_plot (const char *vname,
                  int T,
                  int L,
                  const double *x,
                  gretlopt opt);

Returns


theil_forecast_plot ()

int
theil_forecast_plot (const int *plotlist,
                     const DATASET *dset,
                     gretlopt opt);

Returns


gretl_panel_ts_plot ()

int
gretl_panel_ts_plot (int vnum,
                     DATASET *dset,
                     gretlopt opt);

Returns


plot_fcast_errs ()

int
plot_fcast_errs (const FITRESID *fr,
                 const double *maxerr,
                 const DATASET *dset,
                 gretlopt opt);

Returns


plot_simple_fcast_bands ()

int
plot_simple_fcast_bands (const MODEL *pmod,
                         const FITRESID *fr,
                         const DATASET *dset,
                         gretlopt opt);

Returns


plot_tau_sequence ()

int
plot_tau_sequence (const MODEL *pmod,
                   const DATASET *dset,
                   int k);

Returns


gretl_VAR_plot_impulse_response ()

int
gretl_VAR_plot_impulse_response (GRETL_VAR *var,
                                 int targ,
                                 int shock,
                                 int periods,
                                 double alpha,
                                 const DATASET *dset,
                                 gretlopt opt);

Returns


gretl_VAR_plot_FEVD ()

int
gretl_VAR_plot_FEVD (GRETL_VAR *var,
                     int targ,
                     int periods,
                     const DATASET *dset,
                     gretlopt opt);

Returns


gretl_VAR_plot_multiple_irf ()

int
gretl_VAR_plot_multiple_irf (GRETL_VAR *var,
                             int periods,
                             double alpha,
                             const DATASET *dset,
                             gretlopt opt);

Returns


gretl_VECM_combined_EC_plot ()

int
gretl_VECM_combined_EC_plot (GRETL_VAR *var,
                             const DATASET *dset);

Returns


gretl_system_residual_plot ()

int
gretl_system_residual_plot (void *p,
                            int ci,
                            int eqn,
                            const DATASET *dset);

Returns


gretl_system_residual_mplot ()

int
gretl_system_residual_mplot (void *p,
                             int ci,
                             const DATASET *dset);

Returns


gretl_VAR_roots_plot ()

int
gretl_VAR_roots_plot (GRETL_VAR *var);

Returns


confidence_ellipse_plot ()

int
confidence_ellipse_plot (gretl_matrix *V,
                         double *b,
                         double tcrit,
                         double Fcrit,
                         double alpha,
                         const char *iname,
                         const char *jname);

Plots a 95% confidence ellipse for the parameter estimates in b with covariance V .

Parameters

V

2x2 covariance matrix.

 

b

2-vector containing point estimates

 

tcrit

critical t-value for 1 - alpha confidence.

 

Fcrit

critical F-value for 1 - alpha confidence.

 

alpha

nominal non-coverage, as decimal.

 

iname

name of first parameter.

 

jname

name of second parameter.

 

Returns

0 on success, non-zero on error.


xy_plot_with_control ()

int
xy_plot_with_control (const int *list,
                      const char *literal,
                      const DATASET *dset,
                      gretlopt opt);

Constructs a scatterplot of modified Y against modified X, where the modification consists in taking the residuals from OLS regression of the variable in question on the control variable, a la Frisch-Waugh-Lovell.

Parameters

list

list of variables by ID number: Y, X, control.

 

literal

extra gnuplot commands or NULL.

 

dset

dataset struct.

 

opt

use OPT_G for GUI graph.

 

Returns

0 on success, non-zero on error.


gnuplot_process_file ()

int
gnuplot_process_file (gretlopt opt,
                      PRN *prn);

Respond to the "gnuplot" command with OPT_D, to specify that input should be taken from a user-created gnuplot command file.

Parameters

opt

may include OPT_U for output to specified file.

 

prn

gretl printing struct.

 

Returns

0 on success, or if ignored; otherwise error code.


print_gnuplot_literal_lines ()

void
print_gnuplot_literal_lines (const char *s,
                             FILE *fp);


is_auto_fit_string ()

int
is_auto_fit_string (const char *s);

Returns


gnuplot_has_ttf ()

int
gnuplot_has_ttf (int reset);

Returns


gnuplot_pdf_terminal ()

int
gnuplot_pdf_terminal (void);

Returns


gnuplot_eps_terminal ()

int
gnuplot_eps_terminal (void);

Returns


gnuplot_png_terminal ()

int
gnuplot_png_terminal (void);

Returns


gnuplot_has_cp950 ()

int
gnuplot_has_cp950 (void);

Returns


set_graph_palette ()

void
set_graph_palette (int i,
                   gretlRGB color);


set_graph_palette_from_string ()

void
set_graph_palette_from_string (int i,
                               const char *cstr);


graph_palette_reset ()

void
graph_palette_reset (int i);


print_rgb_hash ()

void
print_rgb_hash (char *s,
                const gretlRGB *color);


gretl_rgb_get ()

void
gretl_rgb_get (gretlRGB *color,
               const char *s);


print_palette_string ()

void
print_palette_string (char *s);


get_graph_color ()

const gretlRGB *
get_graph_color (int i);

Returns


gnuplot_test_command ()

int
gnuplot_test_command (const char *cmd);

See if the installed version of gnuplot will accept a given command.

Parameters

cmd

gnuplot command string.

 

Returns

0 if gnuplot successfully handles the given command, 1 on error.


gnuplot_png_set_use_aa ()

void
gnuplot_png_set_use_aa (int s);


gnuplot_png_set_default_scale ()

void
gnuplot_png_set_default_scale (double s);


date_from_gnuplot_time ()

void
date_from_gnuplot_time (char *targ,
                        size_t tsize,
                        const char *fmt,
                        double x);


gnuplot_time_from_date ()

double
gnuplot_time_from_date (const char *s,
                        const char *fmt);

Returns


gnuplot_version ()

double
gnuplot_version (void);

Returns


gnuplot_has_wxt ()

int
gnuplot_has_wxt (void);

Returns

Types and Values

enum GptFlags

Members

GPT_IMPULSES

   

GPT_LINES

   

GPT_RESIDS

   

GPT_FA

   

GPT_DUMMY

   

GPT_XYZ

   

GPT_FIT_OMIT

   

GPT_DATA_STYLE

   

GPT_IDX

   

GPT_TS

   

GPT_Y2AXIS

   

GPT_AUTO_FIT

   

GPT_FIT_HIDDEN

   

GPT_PNG_OUTPUT

   

GPT_PRINT_MARKERS

   

GPT_LETTERBOX

   

GPT_PARAMETRIC

   

GPT_XZEROAXIS

   

GPT_YZEROAXIS

   

GPT_FILL_SWITCH

   

GPT_ERR_SWITCH

   

GPT_MONO

   

GPT_GRID_Y

   

GPT_GRID_X

   

GPT_POLAR

   

GPT_XL

   

GPT_XXL

   

GPT_TIMEFMT

   

gretlRGB

typedef struct gretlRGB_ gretlRGB;


GPT_SPEC

typedef struct GPT_SPEC_ GPT_SPEC;


MAXTITLE

#define MAXTITLE 128


N_GP_COLORS

#define N_GP_COLORS 8


GP_WIDTH

#define GP_WIDTH      640


GP_HEIGHT

#define GP_HEIGHT     480


GP_LB_WIDTH

#define GP_LB_WIDTH   680


GP_LB_HEIGHT

#define GP_LB_HEIGHT  400


GP_XL_WIDTH

#define GP_XL_WIDTH   680


GP_XL_HEIGHT

#define GP_XL_HEIGHT  510


GP_XXL_WIDTH

#define GP_XXL_WIDTH  680


GP_XXL_HEIGHT

#define GP_XXL_HEIGHT 680


GP_SQ_SIZE

#define GP_SQ_SIZE    480


enum PlotType

Members

PLOT_REGULAR

   

PLOT_H_TEST

   

PLOT_PROB_DIST

   

PLOT_FORECAST

   

PLOT_GARCH

   

PLOT_FREQ_SIMPLE

   

PLOT_FREQ_NORMAL

   

PLOT_FREQ_GAMMA

   

PLOT_PERIODOGRAM

   

PLOT_CORRELOGRAM

   

PLOT_CUSUM

   

PLOT_MULTI_SCATTER

   

PLOT_TRI_GRAPH

   

PLOT_RANGE_MEAN

   

PLOT_HURST

   

PLOT_LEVERAGE

   

PLOT_IRFBOOT

   

PLOT_KERNEL

   

PLOT_ROOTS

   

PLOT_ELLIPSE

   

PLOT_MULTI_IRF

   

PLOT_PANEL

   

PLOT_BI_GRAPH

   

PLOT_MANY_TS

   

PLOT_RQ_TAU

   

PLOT_FACTORIZED

   

PLOT_BOXPLOTS

   

PLOT_CURVE

   

PLOT_QQ

   

PLOT_USER

   

PLOT_XCORRELOGRAM

   

PLOT_TYPE_MAX

   

enum FitType

Members

PLOT_FIT_NONE

   

PLOT_FIT_OLS

   

PLOT_FIT_QUADRATIC

   

PLOT_FIT_CUBIC

   

PLOT_FIT_INVERSE

   

PLOT_FIT_LOESS

   

PLOT_FIT_LOGLIN

   

PLOT_FIT_NA

   

enum TermType

Members

GP_TERM_NONE

   

GP_TERM_PNG

   

GP_TERM_EPS

   

GP_TERM_PDF

   

GP_TERM_FIG

   

GP_TERM_TEX

   

GP_TERM_EMF

   

GP_TERM_SVG

   

GP_TERM_PLT

   

enum PNGTerm

Members

GP_PNG_NONE

   

GP_PNG_GD1

   

GP_PNG_GD2

   

GP_PNG_CAIRO

   

enum PDFTerm

Members

GP_PDF_NONE

   

GP_PDF_PDFLIB

   

GP_PDF_CAIRO

   

enum EPSTerm

Members

GP_EPS_NONE

   

GP_EPS_PS

   

GP_EPS_CAIRO