graphing

graphing

Functions

#define maybe_big_multiplot()
#define frequency_plot_code()
#define set_png_output()
#define get_png_output()
#define unset_png_output()
const char * gretl_gnuplot_term_line ()
const char * get_png_line_for_plotspec ()
char * gretl_png_font_string ()
const char * gp_justification_string ()
int split_graph_fontspec ()
void gnuplot_missval_string ()
void write_gp_dataval ()
FILE * open_plot_input_file ()
FILE * open_3d_plot_input_file ()
int finalize_plot_input_file ()
int finalize_3d_plot_input_file ()
int gnuplot_graph_wanted ()
void gnuplot_cleanup ()
int specified_gp_output_format ()
int write_plot_output_line ()
int write_plot_type_string ()
void write_plot_line_styles ()
int write_plot_bounding_box_request ()
void set_effective_plot_ci ()
void set_special_plot_size ()
void set_special_font_size ()
int set_plotstyle ()
const char * get_plotstyle ()
PlotType plot_type_from_string ()
void plot_get_scaled_dimensions ()
int graph_written_to_file ()
int plot_output_to_buffer ()
int graph_displayed ()
void reset_plot_count ()
int matrix_plot ()
int gnuplot ()
int multi_scatters ()
int matrix_scatters ()
int gnuplot_3d ()
int plot_freq ()
int plot_corrmat ()
int garch_resid_plot ()
int rmplot ()
int hurstplot ()
int qq_plot ()
int kd_plot ()
int hf_plot ()
int correlogram_plot ()
int periodogram_plot ()
int arma_spectrum_plot ()
int theil_forecast_plot ()
int gretl_panel_ts_plot ()
int panel_means_XY_scatter ()
int cli_panel_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_input ()
int print_gnuplot_literal_lines ()
int is_auto_fit_string ()
void set_graph_color_from_string ()
void graph_palette_reset ()
void print_rgb_hash ()
gretlRGB gretl_rgb_get ()
void print_palette_string ()
gretlRGB get_graph_color ()
gretlRGB get_boxcolor ()
gretlRGB get_shadecolor ()
void set_boxcolor ()
void set_shadecolor ()
int parse_gnuplot_color ()
int gnuplot_test_command ()
void gnuplot_png_set_default_scale ()
int gnuplot_has_wxt ()
int write_map_gp_file ()
int transcribe_geoplot_file ()
int write_tdisagg_plot ()

Types and Values

enum GptFlags
#define GP_ASYNC
typedef gretlRGB
typedef GPT_SPEC
#define N_GP_LINETYPES
#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_XW_WIDTH
#define GP_SQ_SIZE
enum PlotType
enum FitType
enum TermType

Description

Functions

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)

gretl_gnuplot_term_line ()

const char *
gretl_gnuplot_term_line (TermType ttype,
                         PlotType ptype,
                         GptFlags flags,
                         const char *font);

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

Parameters

ttype

code for the gnuplot "terminal" type.

 

ptype

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

 

flags

plot option flags.

 

font

if non-NULL, try to respect a specified font.

 

Returns

a static char * pointer.


get_png_line_for_plotspec ()

const char *
get_png_line_for_plotspec (const GPT_SPEC *spec);

gretl_png_font_string ()

char *
gretl_png_font_string (void);

gp_justification_string ()

const char *
gp_justification_string (int j);

split_graph_fontspec ()

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

gnuplot_missval_string ()

void
gnuplot_missval_string (FILE *fp);

write_gp_dataval ()

void
write_gp_dataval (double x,
                  FILE *fp,
                  int final);

open_plot_input_file ()

FILE *
open_plot_input_file (PlotType ptype,
                      GptFlags flags,
                      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, ptype and flags .

Parameters

ptype

indication of the sort of plot to be made.

 

flags

may inflect some characteristics of plot.

 

err

location to receive error code.

 

Returns

writable stream on success, NULL on failure.


open_3d_plot_input_file ()

FILE *
open_3d_plot_input_file (int *iact);

Writes a gnuplot plot file to display a 3D plot (interactive if requested and feasible).

Parameters

iact

on input, non-zero if an interactive plot is preferred, 0 otherwise; on output, non-zero if interactive status can be supported, 0 otherwise.

 

Returns

FILE pointer on success, NULL on error.


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.


finalize_3d_plot_input_file ()

int
finalize_3d_plot_input_file (FILE *fp);

Closes fp and alerts libgretl to the fact that an interactive 3-D plot is wanted.

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);

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);

write_plot_output_line ()

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

write_plot_type_string ()

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

write_plot_line_styles ()

void
write_plot_line_styles (int ptype,
                        FILE *fp);

write_plot_bounding_box_request ()

int
write_plot_bounding_box_request (FILE *fp);

set_effective_plot_ci ()

void
set_effective_plot_ci (int ci);

set_special_plot_size ()

void
set_special_plot_size (float width,
                       float height);

set_special_font_size ()

void
set_special_font_size (int fsize);

set_plotstyle ()

int
set_plotstyle (const char *style);

get_plotstyle ()

const char *
get_plotstyle (void);

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);

plot_output_to_buffer ()

int
plot_output_to_buffer (void);

graph_displayed ()

int
graph_displayed (void);

reset_plot_count ()

void
reset_plot_count (void);

matrix_plot ()

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

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_O 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_O 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_A to force display of fitted surface; may include OPT_I to force an interactive (rotatable) plot. Note that OPT_I may be removed on output if a suitable gnuplot terminal is not present.

 

Returns

0 on successful completion, error code on error.


plot_freq ()

int
plot_freq (FreqDist *freq,
           DistCode dist,
           gretlopt opt);

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.


plot_corrmat ()

int
plot_corrmat (VMatrix *corr,
              gretlopt opt);

Produces a heatmap plot based on a correlation matrix.

Parameters

corr

pointer to correlation matrix struct.

 

opt

can use OPT_T for triangular representation.

 

Returns

0 on successful completion, error code on error.


garch_resid_plot ()

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

rmplot ()

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

hurstplot ()

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

qq_plot ()

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

kd_plot ()

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

hf_plot ()

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

correlogram_plot ()

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

periodogram_plot ()

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

arma_spectrum_plot ()

int
arma_spectrum_plot (MODEL *pmod,
                    const DATASET *dset,
                    gretlopt opt);

theil_forecast_plot ()

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

gretl_panel_ts_plot ()

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

panel_means_XY_scatter ()

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

cli_panel_plot ()

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

plot_fcast_errs ()

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

plot_simple_fcast_bands ()

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

plot_tau_sequence ()

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

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);

gretl_VAR_plot_FEVD ()

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

gretl_VAR_plot_multiple_irf ()

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

gretl_VECM_combined_EC_plot ()

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

gretl_system_residual_plot ()

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

gretl_system_residual_mplot ()

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

gretl_VAR_roots_plot ()

int
gretl_VAR_roots_plot (GRETL_VAR *var);

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

can add "gnuplot" options.

 

Returns

0 on success, non-zero on error.


gnuplot_process_input ()

int
gnuplot_process_input (gretlopt opt,
                       PRN *prn);

Respond to the "gnuplot" command with OPT_I, to specify that input should be taken from a user-created gnuplot command file, or OPT_b, to take input from a named string variable.

Parameters

opt

should be OPT_I (file) or OPT_b (buffer)

 

prn

gretl printing struct.

 

Returns

0 on success, error code on error.


print_gnuplot_literal_lines ()

int
print_gnuplot_literal_lines (const char *s,
                             int ci,
                             gretlopt opt,
                             FILE *fp);

is_auto_fit_string ()

int
is_auto_fit_string (const char *s);

set_graph_color_from_string ()

void
set_graph_color_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,
                gretlRGB color);

gretl_rgb_get ()

gretlRGB
gretl_rgb_get (const char *s);

print_palette_string ()

void
print_palette_string (char *s);

get_graph_color ()

gretlRGB
get_graph_color (int i);

get_boxcolor ()

gretlRGB
get_boxcolor (void);

get_shadecolor ()

gretlRGB
get_shadecolor (void);

set_boxcolor ()

void
set_boxcolor (gretlRGB color);

set_shadecolor ()

void
set_shadecolor (gretlRGB color);

parse_gnuplot_color ()

int
parse_gnuplot_color (const char *s,
                     char *targ);

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_default_scale ()

void
gnuplot_png_set_default_scale (double s);

gnuplot_has_wxt ()

int
gnuplot_has_wxt (void);

write_map_gp_file ()

int
write_map_gp_file (void *ptr);

transcribe_geoplot_file ()

int
transcribe_geoplot_file (const char *src,
                         const char *dest,
                         const char *datname);

write_tdisagg_plot ()

int
write_tdisagg_plot (const gretl_matrix *YY,
                    int mult,
                    const char *title,
                    DATASET *dset);

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_MONO

   

GPT_GRID_Y

   

GPT_GRID_X

   

GPT_POLAR

   

GPT_XL

   

GPT_XXL

   

GPT_XW

   

GPT_TIMEFMT

   

GPT_ICON

   

GPT_STEPS

   

GPT_LOGY

   

GP_ASYNC

#define GP_ASYNC (NC+1)

gretlRGB

typedef guint32 gretlRGB;

GPT_SPEC

typedef struct GPT_SPEC_ GPT_SPEC;

N_GP_LINETYPES

#define N_GP_LINETYPES 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_XW_WIDTH

#define GP_XW_WIDTH   800

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_FREQ_DISCRETE

   

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_BAR

   

PLOT_STACKED_BAR

   

PLOT_3D

   

PLOT_BAND

   

PLOT_HEATMAP

   

PLOT_GEOMAP

   

PLOT_GRIDPLOT

   

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_LINLOG

   

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_HTM

   

GP_TERM_PLT

   

GP_TERM_VAR