Файл src/gplot.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "allheaders.h"

Макросы

#define L_BUF_SIZE   512
#define MAX_NUM_GPLOTS   40

Функции

GPLOTgplotCreate (const char *rootname, l_int32 outformat, const char *title, const char *xlabel, const char *ylabel)
void gplotDestroy (GPLOT **pgplot)
l_int32 gplotAddPlot (GPLOT *gplot, NUMA *nax, NUMA *nay, l_int32 plotstyle, const char *plottitle)
l_int32 gplotSetScaling (GPLOT *gplot, l_int32 scaling)
l_int32 gplotMakeOutput (GPLOT *gplot)
l_int32 gplotGenCommandFile (GPLOT *gplot)
l_int32 gplotGenDataFiles (GPLOT *gplot)
l_int32 gplotSimple1 (NUMA *na, l_int32 outformat, const char *outroot, const char *title)
l_int32 gplotSimple2 (NUMA *na1, NUMA *na2, l_int32 outformat, const char *outroot, const char *title)
l_int32 gplotSimpleN (NUMAA *naa, l_int32 outformat, const char *outroot, const char *title)
GPLOTgplotRead (const char *filename)
l_int32 gplotWrite (const char *filename, GPLOT *gplot)

Переменные

const char * gplotstylenames []
const char * gplotfilestyles []
const char * gplotfileoutputs []

Макросы

#define L_BUF_SIZE   512

#define MAX_NUM_GPLOTS   40


Функции

l_int32 gplotAddPlot ( GPLOT gplot,
NUMA nax,
NUMA nay,
l_int32  plotstyle,
const char *  plottitle 
)

gplotAddPlot()

Input: nax (<optional> numa: set to null for Y_VS_I; required for Y_VS_X) nay (numa: required for both Y_VS_I and Y_VS_X) plotstyle (GPLOT_LINES, GPLOT_POINTS, GPLOT_IMPULSES, GPLOT_LINESPOINTS, GPLOT_DOTS) plottitle (<optional> title for individual plot) Return: 0 if OK, 1 on error

Notes: (1) There are 2 options for (x,y) values: o To plot an array vs the index, set nax = NULL. o To plot one array vs another, use both nax and nay. (2) If nax is defined, it must be the same size as nay. (3) The 'plottitle' string can have spaces, double quotes and backquotes, but not single quotes.

GPLOT* gplotCreate ( const char *  rootname,
l_int32  outformat,
const char *  title,
const char *  xlabel,
const char *  ylabel 
)

gplotCreate()

Input: rootname (root for all output files) outformat (GPLOT_PNG, GPLOT_PS, GPLOT_EPS, GPLOT_X11, GPLOT_LATEX) title (<optional> overall title) xlabel (<optional> x axis label) ylabel (<optional> y axis label) Return: gplot, or null on error

Notes: (1) This initializes the plot. (2) The 'title', 'xlabel' and 'ylabel' strings can have spaces, double quotes and backquotes, but not single quotes.

void gplotDestroy ( GPLOT **  pgplot  ) 

gplotDestroy()

Input: &gplot (<to be="" nulled>="">) Return: void

l_int32 gplotGenCommandFile ( GPLOT gplot  ) 

gplotGenCommandFile()

Input: gplot Return: 0 if OK, 1 on error

l_int32 gplotGenDataFiles ( GPLOT gplot  ) 

gplotGenDataFiles()

Input: gplot Return: 0 if OK, 1 on error

l_int32 gplotMakeOutput ( GPLOT gplot  ) 

gplotMakeOutput()

Input: gplot Return: 0 if OK; 1 on error

Action: this uses gplot and the new arrays to add a plot to the output, by writing a new data file and appending the appropriate plot commands to the command file.

GPLOT* gplotRead ( const char *  filename  ) 

gplotRead()

Input: filename Return: gplot, or NULL on error

l_int32 gplotSetScaling ( GPLOT gplot,
l_int32  scaling 
)

gplotSetScaling()

Input: gplot scaling (GPLOT_LINEAR_SCALE, GPLOT_LOG_SCALE_X, GPLOT_LOG_SCALE_Y, GPLOT_LOG_SCALE_X_Y) Return: 0 if OK; 1 on error

Notes: (1) By default, the x and y axis scaling is linear. (2) Call this function to set semi-log or log-log scaling.

l_int32 gplotSimple1 ( NUMA na,
l_int32  outformat,
const char *  outroot,
const char *  title 
)

gplotSimple1()

Input: na (numa; plot Y_VS_I) outformat (GPLOT_PNG, GPLOT_PS, GPLOT_EPS, GPLOT_X11, GPLOT_LATEX) outroot (root of output files) title (<optional>, can be NULL) Return: 0 if OK, 1 on error

Notes: (1) This gives a line plot of a numa, where the array value is plotted vs the array index. The plot is generated in the specified output format; the title is optional. (2) When calling this function more than once, be sure the outroot strings are different; otherwise, you will overwrite the output files.

l_int32 gplotSimple2 ( NUMA na1,
NUMA na2,
l_int32  outformat,
const char *  outroot,
const char *  title 
)

gplotSimple2()

Input: na1 (numa; we plot Y_VS_I) na2 (ditto) outformat (GPLOT_PNG, GPLOT_PS, GPLOT_EPS, GPLOT_X11, GPLOT_LATEX) outroot (root of output files) title (<optional>) Return: 0 if OK, 1 on error

Notes: (1) This gives a line plot of two numa, where the array values are each plotted vs the array index. The plot is generated in the specified output format; the title is optional. (2) When calling this function more than once, be sure the outroot strings are different; otherwise, you will overwrite the output files.

l_int32 gplotSimpleN ( NUMAA naa,
l_int32  outformat,
const char *  outroot,
const char *  title 
)

gplotSimpleN()

Input: naa (numaa; we plot Y_VS_I for each numa) outformat (GPLOT_PNG, GPLOT_PS, GPLOT_EPS, GPLOT_X11, GPLOT_LATEX) outroot (root of output files) title (<optional>) Return: 0 if OK, 1 on error

Notes: (1) This gives a line plot of all numas in a numaa (array of numa), where the array values are each plotted vs the array index. The plot is generated in the specified output format; the title is optional. (2) When calling this function more than once, be sure the outroot strings are different; otherwise, you will overwrite the output files.

l_int32 gplotWrite ( const char *  filename,
GPLOT gplot 
)

gplotWrite()

Input: filename gplot Return: 0 if OK; 1 on error


Переменные

const char* gplotfileoutputs[]

Инициализатор

 {"",
                                   "PNG",
                                   "PS",
                                   "EPS",
                                   "X11",
                                   "LATEX"}

const char* gplotfilestyles[]

Инициализатор

 {"LINES",
                                  "POINTS",
                                  "IMPULSES", 
                                  "LINESPOINTS",
                                  "DOTS"}

const char* gplotstylenames[]

Инициализатор

 {"with lines",
                                  "with points",
                                  "with impulses",
                                  "with linespoints",
                                  "with dots"}


Документация по Leptonica. Последние изменения: Fri Aug 7 20:31:35 2009. Создано системой  doxygen 1.5.9