libdspl-2.0/dspl/dox/en/gnuplot.dox

161 wiersze
4.4 KiB
Plaintext

/*! ****************************************************************************
\ingroup PLOT_GROUP
\fn int gnuplot_create(int argc, char* argv[], int w, int h, char* fn_png,
void** hplot)
\brief
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.
\param[in] argc
The number of arguments to invoke the program. \n
(number of `argv` variables). \n
This value cannot be less than one, because `argv [0]`
keeps the program executable file name. \n
\n
\param[in] argv
Pointer to a strings array of the executable file parameters . \n
The size of the array is `argc`. \n
`argv [0]` keeps the executable file name. \n
`argv [1]` sets the graph display format: \n
\verbatim
--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.
\endverbatim
\n
\param[in] w
The width of the graph window or png file in pixels. \n
\n
\param[in] h
The height of the graph window or png file in pixels. \n
\n
\param[in] fn_png
Plot png-file name. \n
\param[in, out] hplot
Pointer to the handle address of the GNUPLOT package. \n
A pointer to the current graph will be recorded at this address. This pointer
is required to send GNUPLOT commands. \n
\n
\return
`RES_OK` if function is calculated successfully. \n
Else \ref ERROR_CODE_GROUP "code error".
The `hplot` pointer sets in `NULL` if function returns error. \n
\note
If `argv[1]` parameter equals `--noplot`, then function returns `RES_OK`, but
`hplot` will be set as `NULL`. \n
GNUPLOT handle must be closed by \ref gnuplot_close after plotting.\n
An example of plotting sine and cosine is given in the following listing:
\include gnuplot_script_test.c
This program calculates the values of the sine and cosine functions,
and also saves the text files `dat / cosine.txt` and` dat / sine.txt`. \n
The saved data is displayed on three graphs
(with sine, cosine data by both data):
\image html gnuplot_script_sin.png
\image html gnuplot_script_cos.png
\image html gnuplot_script_sincos.png
\author Sergey Bakhurin www.dsplib.org
**************************************************************************** */
/*! ****************************************************************************
\ingroup PLOT_GROUP
\fn void gnuplot_close(void* h)
\brief
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. \n
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.
\param[in] h
GNUPLOT handle which will be closed. \n
\n
\author Sergey Bakhurin www.dsplib.org
**************************************************************************** */
/*! ****************************************************************************
\ingroup PLOT_GROUP
\fn void gnuplot_cmd(void* h, char* cmd)
\brief
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 string `cmd` to the given file. \n
\n
From the user's point of view, calling the `gnuplot_cmd` function is
GNUPLOT script one line executing. \n
\n
A comprehensive description of the graphing capabilities of the GNUPLOT package,
with examples of commands can be found on
<a href = "http://gnuplot.sourceforge.net/demo_5.2/"> GNUPLOT project </a>.
\param[in] h
GNUPLOT handle. \n
\n
\param[in] cmd
GNUPLOT command string. \n
\n
\author Sergey Bakhurin www.dsplib.org
**************************************************************************** */