![]() |
libdspl-2.0
Digital Signal Processing Algorithm Library
|
Functions | |
int DSPL_API | gnuplot_create (int argc, char *argv[], int w, int h, char *fn_png, void **hplot) |
Create GNUPLOT chart. More... | |
void DSPL_API | gnuplot_close (void *h) |
Close GNUPLOT handle. More... | |
void DSPL_API | gnuplot_cmd (void *h, char *cmd) |
Function sends cmd command to GNUPLOT corresponds to h handle. More... | |
int DSPL_API | gnuplot_open (void **hplot) |
Open GNUPLOT program. More... | |
Detailed Description
Function Documentation
◆ gnuplot_close()
void gnuplot_close | ( | void * | h | ) |
Close GNUPLOT handle.
This function closes the previously opened GNUPLOT handle after transferring all commands.
- Note
- From a system point of view,
h
is a pointer to an open file in which You can write commands for execution by the GNUPLOT package. This function closes this file.
It is important to note that closing the handle does not mean closing the plot window. After closing the package handle, the user cannot send build commands, but the plot window remains open, as it is processed by the package GNUPLOT regardless.
- Parameters
-
[in] h GNUPLOT handle which will be closed.
◆ gnuplot_cmd()
void gnuplot_cmd | ( | void * | h, |
char * | cmd | ||
) |
Function sends cmd
command to GNUPLOT corresponds to h
handle.
- Note
- From a system point of view,
h
is a pointer to an open file, into which you can write commands for execution by the GNUPLOT package. This function writes the stringcmd
to the given file.
From the user's point of view, calling thegnuplot_cmd
function is GNUPLOT script one line executing.
A comprehensive description of the graphing capabilities of the GNUPLOT package, with examples of commands can be found on GNUPLOT project .
- Parameters
-
[in] h GNUPLOT handle.
[in] cmd GNUPLOT command string.
Definition at line 390 of file gnuplot.c.
Referenced by gnuplot_create().
◆ gnuplot_create()
int gnuplot_create | ( | int | argc, |
char * | argv[], | ||
int | w, | ||
int | h, | ||
char * | fn_png, | ||
void ** | hplot | ||
) |
Create GNUPLOT chart.
This function opens the GNUPLOT package depending on the argv
parameters passed to the program. After calling this function, the handle of the graph will be written to the address hplot
and it becomes possible to send GNUPLOT commands to display the graphs.
- Note
- From a system point of view,
hplot
is a pointer to an open file in which you can write commands for execution by the GNUPLOT package.
- Parameters
-
[in] argc The number of arguments to invoke the program.
(number ofargv
variables).
This value cannot be less than one, becauseargv [0]
keeps the program executable file name.
[in] argv Pointer to a strings array of the executable file parameters .
The size of the array isargc
.
argv [0]
keeps the executable file name.
argv [1]
sets the graph display format:
--plotwin display the graph in a individual window (this parameter is used by default); --plotpng save the plot to a `fn_png` png file; --noplot plot not to create, ignore all GNUPLOT commands.
[in] w The width of the graph window or png file in pixels.
[in] h The height of the graph window or png file in pixels.
[in] fn_png Plot png-file name.
[in,out] hplot Pointer to the handle address of the GNUPLOT package.
A pointer to the current graph will be recorded at this address. This pointer is required to send GNUPLOT commands.
- Returns
RES_OK
if function is calculated successfully.
Else code error. Thehplot
pointer sets inNULL
if function returns error.
- Note
- If
argv[1]
parameter equals--noplot
, then function returnsRES_OK
, buthplot
will be set asNULL
.
GNUPLOT handle must be closed by gnuplot_close after plotting.
An example of plotting sine and cosine is given in the following listing:
This program calculates the values of the sine and cosine functions, and also saves the text files dat / cosine.txt
anddat / sine.txt
.
The saved data is displayed on three graphs (with sine, cosine data by both data):



◆ gnuplot_open()
int gnuplot_open | ( | void ** | hplot | ) |
Open GNUPLOT program.
This function opens the GNUPLOT package. After calling this function, the handle of the GNUPLOT will be written to the address hplot
and it becomes possible to send GNUPLOT commands.
- Note
- From a system point of view,
hplot
is a pointer to an open file in which you can write commands for execution by the GNUPLOT package.
- Parameters
-
[in,out] hplot Pointer to the handle address of the GNUPLOT package.
This pointer is required to send GNUPLOT commands.
- Returns
RES_OK
if function is calculated successfully.
Else code error. Thehplot
pointer sets inNULL
if function returns error.
GNUPLOT handle must be closed by gnuplot_close after plotting.
An example of plotting sine and cosine is given in the following listing:
- Note
- The difference between
gnuplot_open
andgnuplot_create
is thatgnuplot_create
processes the program execution parameters and creates a GNUPLOT terminal.
The gnuplot_open function opens the GNUPLOT handle to be able to send commands, regardless of program execution parameters, but does not create terminals.
Generated on Mon Dec 14 2020 14:02:36 for libdspl-2.0 by
