Page 19 - Demo
P. 19
Interface to Gauss%uf09f%uf09fRCPConsult2022-2025Page 19This is the list of accessible procedures for plot generation using GnuplotintGnuplotInit()Initialize Gnuplot environmentReturns 0if success, otherwise 1intGnuplotWindow(np, x, y, w, h)Set position and size of plot in direct screen coordinatesnp (double)%u2013number of plotx, y (doubles)%u2013offset of top left cornerw, h (doubles)%u2013width and height of plotintGnuplotWindowRelative(np, wP, hP, c)Set plot dimensions in relative screen coordinatesnp (double)%u2013number of plotxP, yP (doubles)%u2013width and height in percents of screen sizec (double)1centered, 0cascadedintGnuplotWindowTitle(np, title)Define a plot titlenp (double)%u2013number of plottitle (string) title of plotintGnuplotPut(np, command)Put next command in the plot stacknp (double)%u2013number of plotcommand (string) command textintGnuplotPlot(np, command, data)Put a plot command and text data in the plot stacknp (double)number of plotcommand (string) command textdata (string)%u2013text dataintGnuplotPlotS(np, command, data)Put a plot command and text 3D data in the plot stacknp (double)%u2013number of plotcommand (string)%u2013command textdata (string)%u2013text dataintGnuplotPlotData(np, command, data, col, row)Put a plot command and binary data in the plot stacknp (double)%u2013number of plotcommand (string) %u2013command textdata (double *) %u2013binary data (array)col, row (doubles)dimension of binary data (array)intGnuplotPlotDataS(np, command, data, col, row, step)Put a plot command and binary 3D data in the plot stacknp (double)number of plotcommand (string) command textdata (double *) %u2013binary data (array)col, row (doubles)%u2013dimension of binary data (array)step (double)%u2013number of rows separated by empty lineint GnuplotShow(np)Display final state of plotnp (double)%u2013number of plotintGnuplotExport(np, filename)Export final state of plot as PNG-filenp (double)%u2013number of plotfilename (string)%u2013name of export fileintGnuplotEnd()Close a Gnuplot sessionThe invoking of plot generation in the source file is very straightforward. First you needto initialize theGnuplotenvironment// Load a support library GaussGnuplot.dll from MTENGHOME?? dlibdlibraryGaussGnuplot;// Set local variableslocalnp,xpp,ypp,cp,titl,text;// Initialize an Gnuplot environmentdllcall-r GnuplotInit;Next, you need to create a plot window, for example// Create an output windownp=1;xpp=40;ypp=40;cp=1;dllcallGnuplotWindowRelative(np,xpp,ypp,cp);//1 plot number, 40% of screen size, centeredThen, an arbitrary set of plot creation statements can be used depending on the plot to be producedtitl=\dllcallGnuplotWindowTitle(np,titl);text=\dllcallGnuplotPut(np,text);...Finally, all collected plot elements can be shown bydllcallGnuplotShow(np);and Gnuplotenvironment need to be closed bydllcallGnuplotEnd;