Update of /cvsroot/basedb/basedb/exec/source/pca/gnuplot_i-2.6/html In directory usw-pr-cvs1:/tmp/cvs-serv28128/gnuplot_i-2.6/html Added Files: doxygen.css gnuplot_i_c-source.html gnuplot_i_c.html gnuplot_i_h-source.html gnuplot_i_h.html index.html struct__GNUPLOT_CTRL_.html Log Message: Added PCA plugin from Greg Voronin --- NEW FILE: doxygen.css --- H1 { text-align: center; } A.qindex {} A.qindexRef {} A.el { text-decoration: none; font-weight: bold } A.elRef { font-weight: bold } A.code { text-decoration: none; font-weight: normal; color: #4444ee } A.codeRef { font-weight: normal; color: #4444ee } DL.el { margin-left: -1cm } DIV.fragment { width: 100%; border: none; background-color: #eeeeee } DIV.ah { background-color: black; margin-bottom: 3; margin-top: 3 } TD.md { background-color: #f2f2ff } DIV.groupHeader { margin-left: 16; margin-top: 12; margin-bottom: 6; font-weight: bold } DIV.groupText { margin-left: 16; font-style: italic; font-size: smaller } FONT.keyword { color: #008000 } FONT.keywordtype { color: #604020 } FONT.keywordflow { color: #e08000 } FONT.comment { color: #800000 } FONT.preprocessor { color: #806020 } FONT.stringliteral { color: #002080 } FONT.charliteral { color: #008080 } --- NEW FILE: gnuplot_i_c-source.html --- <html> <head> <meta name="author" content="nde...@fr..."> <meta name="editor" content="nde...@fr..."> <meta name="maintainer" content="nde...@fr..."> <meta name="keywords" content="gnuplot, interface, ANSI C"> <link href="doxygen.css" rel="stylesheet" type="text/css"> <title>gnuplot_i 2.x</title> </head> <body text="#000000" bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Tue Oct 23 15:29:10 2001 --> <h1>gnuplot_i.c</h1><a href="gnuplot_i_c.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 00002 00003 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00017 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00018 00019 <font class="comment">/*</font> 00020 <font class="comment"> $Id: gnuplot_i_c-source.html,v 1.1 2002/08/31 11:04:52 troein Exp $</font> 00021 <font class="comment"> $Author: troein $</font> 00022 <font class="comment"> $Date: 2002/08/31 11:04:52 $</font> 00023 <font class="comment"> $Revision: 1.1 $</font> 00024 <font class="comment"> */</font> 00025 00026 <font class="comment">/*---------------------------------------------------------------------------</font> 00027 <font class="comment"> Includes</font> 00028 <font class="comment"> ---------------------------------------------------------------------------*/</font> 00029 00030 <font class="preprocessor">#include "<a class="code" href="gnuplot_i_h.html">gnuplot_i.h</a>"</font> 00031 00032 <font class="comment">/*---------------------------------------------------------------------------</font> 00033 <font class="comment"> Defines</font> 00034 <font class="comment"> ---------------------------------------------------------------------------*/</font> 00035 00037 <font class="preprocessor">#define GP_CMD_SIZE 2048</font> 00038 <font class="preprocessor"></font> 00039 <font class="preprocessor">#define GP_TITLE_SIZE 80</font> 00040 <font class="preprocessor"></font> 00041 <font class="preprocessor">#define GP_EQ_SIZE 512</font> 00042 <font class="preprocessor"></font> 00043 <font class="preprocessor">#define PATH_MAXNAMESZ 4096</font> 00044 <font class="preprocessor"></font> 00046 <font class="preprocessor">#ifndef P_tmpdir</font> 00047 <font class="preprocessor"></font><font class="preprocessor">#define P_tmpdir "."</font> 00048 <font class="preprocessor"></font><font class="preprocessor">#endif</font> 00049 <font class="preprocessor"></font> 00050 <font class="comment">/*---------------------------------------------------------------------------</font> 00051 <font class="comment"> Function codes</font> 00052 <font class="comment"> ---------------------------------------------------------------------------*/</font> 00053 00054 00055 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00083 <font class="comment">/*-------------------------------------------------------------------------*/</font> <a name="l00084"></a><a class="code" href="gnuplot_i_c.html#a1">00084</a> <font class="keywordtype">char</font> * <a class="code" href="gnuplot_i_h.html#a1">gnuplot_get_program_path</a>(<font class="keywordtype">char</font> * pname)<font class="keyword"></font> 00085 <font class="keyword"></font>{ 00086 <font class="keywordtype">int</font> i, j, lg; 00087 <font class="keywordtype">char</font> * path; 00088 <font class="keyword">static</font> <font class="keywordtype">char</font> buf[PATH_MAXNAMESZ]; 00089 00090 <font class="comment">/* Trivial case: try in CWD */</font> 00091 sprintf(buf, <font class="stringliteral">"./%s"</font>, pname) ; 00092 <font class="keywordflow">if</font> (access(buf, X_OK)==0) { 00093 sprintf(buf, <font class="stringliteral">"."</font>); 00094 <font class="keywordflow">return</font> buf ; 00095 } 00096 <font class="comment">/* Try out in all paths given in the PATH variable */</font> 00097 buf[0] = 0; 00098 path = getenv(<font class="stringliteral">"PATH"</font>) ; 00099 <font class="keywordflow">if</font> (path!=NULL) { 00100 <font class="keywordflow">for</font> (i=0; path[i]; ) { 00101 <font class="keywordflow">for</font> (j=i ; (path[j]) && (path[j]!=<font class="charliteral">':'</font>) ; j++); 00102 lg = j - i; 00103 strncpy(buf, path + i, lg); 00104 <font class="keywordflow">if</font> (lg == 0) buf[lg++] = <font class="charliteral">'.'</font>; 00105 buf[lg++] = <font class="charliteral">'/'</font>; 00106 strcpy(buf + lg, pname); 00107 <font class="keywordflow">if</font> (access(buf, X_OK) == 0) { 00108 <font class="comment">/* Found it! */</font> 00109 <font class="keywordflow">break</font> ; 00110 } 00111 buf[0] = 0; 00112 i = j; 00113 <font class="keywordflow">if</font> (path[i] == <font class="charliteral">':'</font>) i++ ; 00114 } 00115 } <font class="keywordflow">else</font> { 00116 fprintf(stderr, <font class="stringliteral">"PATH variable not set\n"</font>); 00117 } 00118 <font class="comment">/* If the buffer is still empty, the command was not found */</font> 00119 <font class="keywordflow">if</font> (buf[0] == 0) <font class="keywordflow">return</font> NULL ; 00120 <font class="comment">/* Otherwise truncate the command name to yield path only */</font> 00121 lg = strlen(buf) - 1 ; 00122 <font class="keywordflow">while</font> (buf[lg]!=<font class="charliteral">'/'</font>) { 00123 buf[lg]=0 ; 00124 lg -- ; 00125 } 00126 buf[lg] = 0; 00127 <font class="keywordflow">return</font> buf ; 00128 } 00129 00130 00131 00132 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00143 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00144 <a name="l00145"></a><a class="code" href="gnuplot_i_c.html#a2">00145</a> <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * <a class="code" href="gnuplot_i_c.html#a1">gnuplot_init</a>(<font class="keywordtype">void</font>)<font class="keyword"></font> 00146 <font class="keyword"></font>{ 00147 <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * handle ; 00148 00149 <font class="keywordflow">if</font> (getenv(<font class="stringliteral">"DISPLAY"</font>) == NULL) { 00150 fprintf(stderr, <font class="stringliteral">"cannot find DISPLAY variable: is it set?\n"</font>) ; 00151 } 00152 <font class="keywordflow">if</font> (<a class="code" href="gnuplot_i_h.html#a1">gnuplot_get_program_path</a>(<font class="stringliteral">"gnuplot"</font>)==NULL) { 00153 fprintf(stderr, <font class="stringliteral">"cannot find gnuplot in your PATH"</font>); 00154 <font class="keywordflow">return</font> NULL ; 00155 } 00156 00157 <font class="comment">/* </font> 00158 <font class="comment"> * Structure initialization:</font> 00159 <font class="comment"> */</font> 00160 handle = (<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a>*)malloc(<font class="keyword">sizeof</font>(<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a>)) ; 00161 handle->nplots = 0 ; 00162 <a class="code" href="gnuplot_i_h.html#a5">gnuplot_setstyle</a>(handle, <font class="stringliteral">"points"</font>) ; 00163 handle->ntmp = 0 ; 00164 00165 handle->gnucmd = popen(<font class="stringliteral">"gnuplot"</font>, <font class="stringliteral">"w"</font>) ; 00166 <font class="keywordflow">if</font> (handle->gnucmd == NULL) { 00167 fprintf(stderr, <font class="stringliteral">"error starting gnuplot\n"</font>) ; 00168 free(handle) ; 00169 <font class="keywordflow">return</font> NULL ; 00170 } 00171 <font class="keywordflow">return</font> handle; 00172 } 00173 00174 00175 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00186 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00187 <a name="l00188"></a><a class="code" href="gnuplot_i_c.html#a3">00188</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a3">gnuplot_close</a>(<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * handle)<font class="keyword"></font> 00189 <font class="keyword"></font>{ 00190 <font class="keywordtype">int</font> i ; 00191 00192 <font class="keywordflow">if</font> (pclose(handle->gnucmd) == -1) { 00193 fprintf(stderr, <font class="stringliteral">"problem closing communication to gnuplot\n"</font>) ; 00194 <font class="keywordflow">return</font> ; 00195 } 00196 <font class="keywordflow">if</font> (handle->ntmp) { 00197 <font class="keywordflow">for</font> (i=0 ; i<handle->ntmp ; i++) { 00198 remove(handle->to_delete[i]) ; 00199 } 00200 } 00201 free(handle) ; 00202 <font class="keywordflow">return</font> ; 00203 } 00204 00205 00206 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00229 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00230 <a name="l00231"></a><a class="code" href="gnuplot_i_c.html#a4">00231</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a4">gnuplot_cmd</a>(<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * handle, <font class="keywordtype">char</font> * cmd, ...)<font class="keyword"></font> 00232 <font class="keyword"></font>{ 00233 va_list ap ; 00234 <font class="keywordtype">char</font> local_cmd[GP_CMD_SIZE]; 00235 00236 va_start(ap, cmd); 00237 vsprintf(local_cmd, cmd, ap); 00238 va_end(ap); 00239 00240 strcat(local_cmd, <font class="stringliteral">"\n"</font>); 00241 00242 fputs(local_cmd, handle->gnucmd) ; 00243 fflush(handle->gnucmd) ; 00244 <font class="keywordflow">return</font> ; 00245 } 00246 00247 00248 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00268 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00269 <a name="l00270"></a><a class="code" href="gnuplot_i_c.html#a5">00270</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a5">gnuplot_setstyle</a>(<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * h, <font class="keywordtype">char</font> * plot_style)<font class="keyword"> </font> 00271 <font class="keyword"></font>{ 00272 <font class="keywordflow">if</font> (strcmp(plot_style, <font class="stringliteral">"lines"</font>) && 00273 strcmp(plot_style, <font class="stringliteral">"points"</font>) && 00274 strcmp(plot_style, <font class="stringliteral">"linespoints"</font>) && 00275 strcmp(plot_style, <font class="stringliteral">"impulses"</font>) && 00276 strcmp(plot_style, <font class="stringliteral">"dots"</font>) && 00277 strcmp(plot_style, <font class="stringliteral">"steps"</font>) && 00278 strcmp(plot_style, <font class="stringliteral">"errorbars"</font>) && 00279 strcmp(plot_style, <font class="stringliteral">"boxes"</font>) && 00280 strcmp(plot_style, <font class="stringliteral">"boxerrorbars"</font>)) { 00281 fprintf(stderr, <font class="stringliteral">"warning: unknown requested style: using points\n"</font>) ; 00282 strcpy(h->pstyle, "points") ; 00283 } <font class="keywordflow">else</font> { 00284 strcpy(h->pstyle, plot_style) ; 00285 } 00286 <font class="keywordflow">return</font> ; 00287 } 00288 00289 00290 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00299 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00300 <a name="l00301"></a><a class="code" href="gnuplot_i_c.html#a6">00301</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a6">gnuplot_set_xlabel</a>(<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * h, <font class="keywordtype">char</font> * label)<font class="keyword"></font> 00302 <font class="keyword"></font>{ 00303 <font class="keywordtype">char</font> cmd[GP_CMD_SIZE] ; 00304 00305 sprintf(cmd, <font class="stringliteral">"set xlabel \"%s\""</font>, label) ; 00306 <a class="code" href="gnuplot_i_h.html#a4">gnuplot_cmd</a>(h, cmd) ; 00307 <font class="keywordflow">return</font> ; 00308 } 00309 00310 00311 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00320 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00321 <a name="l00322"></a><a class="code" href="gnuplot_i_c.html#a7">00322</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a7">gnuplot_set_ylabel</a>(<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * h, <font class="keywordtype">char</font> * label)<font class="keyword"></font> 00323 <font class="keyword"></font>{ 00324 <font class="keywordtype">char</font> cmd[GP_CMD_SIZE] ; 00325 00326 sprintf(cmd, <font class="stringliteral">"set ylabel \"%s\""</font>, label) ; 00327 <a class="code" href="gnuplot_i_h.html#a4">gnuplot_cmd</a>(h, cmd) ; 00328 <font class="keywordflow">return</font> ; 00329 } 00330 00331 00332 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00341 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00342 <a name="l00343"></a><a class="code" href="gnuplot_i_c.html#a8">00343</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a8">gnuplot_resetplot</a>(<a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * h)<font class="keyword"></font> 00344 <font class="keyword"></font>{ 00345 <font class="keywordtype">int</font> i ; 00346 <font class="keywordflow">if</font> (h->ntmp) { 00347 <font class="keywordflow">for</font> (i=0 ; i<h->ntmp ; i++) { 00348 remove(h->to_delete[i]) ; 00349 } 00350 } 00351 h->ntmp = 0 ; 00352 h->nplots = 0 ; 00353 <font class="keywordflow">return</font> ; 00354 } 00355 00356 00357 00358 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00387 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00388 <a name="l00389"></a><a class="code" href="gnuplot_i_c.html#a9">00389</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a9">gnuplot_plot_x</a>( 00390 <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * handle, 00391 <font class="keywordtype">double</font> * d, 00392 <font class="keywordtype">int</font> n, 00393 <font class="keywordtype">char</font> * title 00394 )<font class="keyword"></font> 00395 <font class="keyword"></font>{ 00396 <font class="keywordtype">int</font> i ; 00397 <font class="keywordtype">int</font> tmpfd ; 00398 <font class="keywordtype">char</font> name[128] ; 00399 <font class="keywordtype">char</font> cmd[GP_CMD_SIZE] ; 00400 <font class="keywordtype">char</font> line[GP_CMD_SIZE] ; 00401 00402 00403 <font class="keywordflow">if</font> (handle==NULL || d==NULL || (n<1)) <font class="keywordflow">return</font> ; 00404 00405 <font class="comment">/* Open one more temporary file? */</font> 00406 <font class="keywordflow">if</font> (handle->ntmp == GP_MAX_TMP_FILES - 1) { 00407 fprintf(stderr, 00408 <font class="stringliteral">"maximum # of temporary files reached (%d): cannot open more"</font>, 00409 GP_MAX_TMP_FILES) ; 00410 <font class="keywordflow">return</font> ; 00411 } 00412 00413 <font class="comment">/* Open temporary file for output */</font> 00414 sprintf(name, <font class="stringliteral">"%s/gnuplot-i-XXXXXX"</font>, P_tmpdir); 00415 <font class="keywordflow">if</font> ((tmpfd=mkstemp(name))==-1) { 00416 fprintf(stderr,<font class="stringliteral">"cannot create temporary file: exiting plot"</font>) ; 00417 <font class="keywordflow">return</font> ; 00418 } 00419 00420 <font class="comment">/* Store file name in array for future deletion */</font> 00421 strcpy(handle->to_delete[handle->ntmp], name) ; 00422 handle->ntmp ++ ; 00423 <font class="comment">/* Write data to this file */</font> 00424 <font class="keywordflow">for</font> (i=0 ; i<n ; i++) { 00425 sprintf(line, <font class="stringliteral">"%g\n"</font>, d[i]); 00426 write(tmpfd, line, strlen(line)); 00427 } 00428 close(tmpfd) ; 00429 00430 <font class="comment">/* Command to be sent to gnuplot */</font> 00431 <font class="keywordflow">if</font> (handle->nplots > 0) { 00432 strcpy(cmd, <font class="stringliteral">"replot"</font>) ; 00433 } <font class="keywordflow">else</font> { 00434 strcpy(cmd, <font class="stringliteral">"plot"</font>) ; 00435 } 00436 00437 <font class="keywordflow">if</font> (title == NULL) { 00438 sprintf(line, <font class="stringliteral">"%s \"%s\" with %s"</font>, cmd, name, handle->pstyle) ; 00439 } <font class="keywordflow">else</font> { 00440 sprintf(line, <font class="stringliteral">"%s \"%s\" title \"%s\" with %s"</font>, cmd, name, 00441 title, handle->pstyle) ; 00442 } 00443 00444 <font class="comment">/* send command to gnuplot */</font> 00445 <a class="code" href="gnuplot_i_h.html#a4">gnuplot_cmd</a>(handle, line) ; 00446 handle->nplots++ ; 00447 <font class="keywordflow">return</font> ; 00448 } 00449 00450 00451 00452 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00482 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00483 <a name="l00484"></a><a class="code" href="gnuplot_i_c.html#a10">00484</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a10">gnuplot_plot_xy</a>( 00485 <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * handle, 00486 <font class="keywordtype">double</font> * x, 00487 <font class="keywordtype">double</font> * y, 00488 <font class="keywordtype">int</font> n, 00489 <font class="keywordtype">char</font> * title 00490 )<font class="keyword"></font> 00491 <font class="keyword"></font>{ 00492 <font class="keywordtype">int</font> i ; 00493 <font class="keywordtype">int</font> tmpfd ; 00494 <font class="keywordtype">char</font> name[128] ; 00495 <font class="keywordtype">char</font> cmd[GP_CMD_SIZE] ; 00496 <font class="keywordtype">char</font> line[GP_CMD_SIZE] ; 00497 00498 <font class="keywordflow">if</font> (handle==NULL || x==NULL || y==NULL || (n<1)) <font class="keywordflow">return</font> ; 00499 00500 <font class="comment">/* Open one more temporary file? */</font> 00501 <font class="keywordflow">if</font> (handle->ntmp == GP_MAX_TMP_FILES - 1) { 00502 fprintf(stderr, 00503 <font class="stringliteral">"maximum # of temporary files reached (%d): cannot open more"</font>, 00504 GP_MAX_TMP_FILES) ; 00505 <font class="keywordflow">return</font> ; 00506 } 00507 00508 <font class="comment">/* Open temporary file for output */</font> 00509 sprintf(name, <font class="stringliteral">"%s/gnuplot-i-XXXXXX"</font>, P_tmpdir); 00510 <font class="keywordflow">if</font> ((tmpfd=mkstemp(name))==-1) { 00511 fprintf(stderr,<font class="stringliteral">"cannot create temporary file: exiting plot"</font>) ; 00512 <font class="keywordflow">return</font> ; 00513 } 00514 <font class="comment">/* Store file name in array for future deletion */</font> 00515 strcpy(handle->to_delete[handle->ntmp], name) ; 00516 handle->ntmp ++ ; 00517 00518 <font class="comment">/* Write data to this file */</font> 00519 <font class="keywordflow">for</font> (i=0 ; i<n; i++) { 00520 sprintf(line, <font class="stringliteral">"%g %g\n"</font>, x[i], y[i]) ; 00521 write(tmpfd, line, strlen(line)); 00522 } 00523 close(tmpfd) ; 00524 00525 <font class="comment">/* Command to be sent to gnuplot */</font> 00526 <font class="keywordflow">if</font> (handle->nplots > 0) { 00527 strcpy(cmd, <font class="stringliteral">"replot"</font>) ; 00528 } <font class="keywordflow">else</font> { 00529 strcpy(cmd, <font class="stringliteral">"plot"</font>) ; 00530 } 00531 00532 <font class="keywordflow">if</font> (title == NULL) { 00533 sprintf(line, <font class="stringliteral">"%s \"%s\" with %s"</font>, cmd, name, handle->pstyle) ; 00534 } <font class="keywordflow">else</font> { 00535 sprintf(line, <font class="stringliteral">"%s \"%s\" title \"%s\" with %s"</font>, cmd, name, 00536 title, handle->pstyle) ; 00537 } 00538 00539 <font class="comment">/* send command to gnuplot */</font> 00540 <a class="code" href="gnuplot_i_h.html#a4">gnuplot_cmd</a>(handle, line) ; 00541 handle->nplots++ ; 00542 <font class="keywordflow">return</font> ; 00543 } 00544 00545 00546 00547 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00566 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00567 <a name="l00568"></a><a class="code" href="gnuplot_i_c.html#a11">00568</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a11">gnuplot_plot_once</a>( 00569 <font class="keywordtype">char</font> * title, 00570 <font class="keywordtype">char</font> * style, 00571 <font class="keywordtype">char</font> * label_x, 00572 <font class="keywordtype">char</font> * label_y, 00573 <font class="keywordtype">double</font> * x, 00574 <font class="keywordtype">double</font> * y, 00575 <font class="keywordtype">int</font> n 00576 )<font class="keyword"></font> 00577 <font class="keyword"></font>{ 00578 <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * handle ; 00579 00580 <font class="keywordflow">if</font> (x==NULL || n<1) <font class="keywordflow">return</font> ; 00581 00582 handle = <a class="code" href="gnuplot_i_c.html#a1">gnuplot_init</a>(); 00583 <font class="keywordflow">if</font> (style!=NULL) { 00584 <a class="code" href="gnuplot_i_h.html#a5">gnuplot_setstyle</a>(handle, style); 00585 } <font class="keywordflow">else</font> { 00586 <a class="code" href="gnuplot_i_h.html#a5">gnuplot_setstyle</a>(handle, <font class="stringliteral">"lines"</font>); 00587 } 00588 <font class="keywordflow">if</font> (label_x!=NULL) { 00589 <a class="code" href="gnuplot_i_h.html#a6">gnuplot_set_xlabel</a>(handle, label_x); 00590 } <font class="keywordflow">else</font> { 00591 <a class="code" href="gnuplot_i_h.html#a6">gnuplot_set_xlabel</a>(handle, <font class="stringliteral">"X"</font>); 00592 } 00593 <font class="keywordflow">if</font> (label_y!=NULL) { 00594 <a class="code" href="gnuplot_i_h.html#a7">gnuplot_set_ylabel</a>(handle, label_y); 00595 } <font class="keywordflow">else</font> { 00596 <a class="code" href="gnuplot_i_h.html#a7">gnuplot_set_ylabel</a>(handle, <font class="stringliteral">"Y"</font>); 00597 } 00598 <font class="keywordflow">if</font> (y==NULL) { 00599 <a class="code" href="gnuplot_i_h.html#a9">gnuplot_plot_x</a>(handle, x, n, title); 00600 } <font class="keywordflow">else</font> { 00601 <a class="code" href="gnuplot_i_h.html#a10">gnuplot_plot_xy</a>(handle, x, y, n, title); 00602 } 00603 printf(<font class="stringliteral">"press ENTER to continue\n"</font>); 00604 <font class="keywordflow">while</font> (getchar()!=<font class="charliteral">'\n'</font>) {} 00605 <a class="code" href="gnuplot_i_h.html#a3">gnuplot_close</a>(handle); 00606 <font class="keywordflow">return</font> ; 00607 } 00608 00609 00610 00611 00612 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00637 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00638 00639 <a name="l00640"></a><a class="code" href="gnuplot_i_c.html#a12">00640</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a12">gnuplot_plot_slope</a>( 00641 <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * handle, 00642 <font class="keywordtype">double</font> a, 00643 <font class="keywordtype">double</font> b, 00644 <font class="keywordtype">char</font> * title 00645 )<font class="keyword"></font> 00646 <font class="keyword"></font>{ 00647 <font class="keywordtype">char</font> stitle[GP_TITLE_SIZE] ; 00648 <font class="keywordtype">char</font> cmd[GP_CMD_SIZE] ; 00649 00650 <font class="keywordflow">if</font> (title == NULL) { 00651 strcpy(stitle, <font class="stringliteral">"no title"</font>) ; 00652 } <font class="keywordflow">else</font> { 00653 strcpy(stitle, title) ; 00654 } 00655 00656 <font class="keywordflow">if</font> (handle->nplots > 0) { 00657 sprintf(cmd, <font class="stringliteral">"replot %g * x + %g title \"%s\" with %s"</font>, 00658 a, b, title, handle->pstyle) ; 00659 } <font class="keywordflow">else</font> { 00660 sprintf(cmd, <font class="stringliteral">"plot %g * x + %g title \"%s\" with %s"</font>, 00661 a, b, title, handle->pstyle) ; 00662 } 00663 <a class="code" href="gnuplot_i_h.html#a4">gnuplot_cmd</a>(handle, cmd) ; 00664 handle->nplots++ ; 00665 <font class="keywordflow">return</font> ; 00666 } 00667 00668 00669 <font class="comment">/*-------------------------------------------------------------------------*/</font> 00692 <font class="comment">/*--------------------------------------------------------------------------*/</font> 00693 <a name="l00694"></a><a class="code" href="gnuplot_i_c.html#a13">00694</a> <font class="keywordtype">void</font> <a class="code" href="gnuplot_i_h.html#a13">gnuplot_plot_equation</a>( 00695 <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * h, 00696 <font class="keywordtype">char</font> * equation, 00697 <font class="keywordtype">char</font> * title 00698 )<font class="keyword"></font> 00699 <font class="keyword"></font>{ 00700 <font class="keywordtype">char</font> cmd[GP_CMD_SIZE]; 00701 <font class="keywordtype">char</font> plot_str[GP_EQ_SIZE] ; 00702 <font class="keywordtype">char</font> title_str[GP_TITLE_SIZE] ; 00703 00704 <font class="keywordflow">if</font> (title == NULL) { 00705 strcpy(title_str, <font class="stringliteral">"no title"</font>) ; 00706 } <font class="keywordflow">else</font> { 00707 strcpy(title_str, title) ; 00708 } 00709 <font class="keywordflow">if</font> (h->nplots > 0) { 00710 strcpy(plot_str, <font class="stringliteral">"replot"</font>) ; 00711 } <font class="keywordflow">else</font> { 00712 strcpy(plot_str, <font class="stringliteral">"plot"</font>) ; 00713 } 00714 00715 sprintf(cmd, <font class="stringliteral">"%s %s title \"%s\" with %s"</font>, 00716 plot_str, equation, title_str, h->pstyle) ; 00717 <a class="code" href="gnuplot_i_h.html#a4">gnuplot_cmd</a>(h, cmd) ; 00718 h->nplots++ ; 00719 <font class="keywordflow">return</font> ; 00720 } 00721 </div></pre> <hr> Last modified: Tue Oct 23 15:29:10 2001 </hr> </body> </html> --- NEW FILE: gnuplot_i_c.html --- <html> <head> <meta name="author" content="nde...@fr..."> <meta name="editor" content="nde...@fr..."> <meta name="maintainer" content="nde...@fr..."> <meta name="keywords" content="gnuplot, interface, ANSI C"> <link href="doxygen.css" rel="stylesheet" type="text/css"> <title>gnuplot_i 2.x</title> </head> <body text="#000000" bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.5 on Tue Oct 23 15:29:10 2001 --> <h1>gnuplot_i.c File Reference</h1>C interface to gnuplot. <a href="#_details">More...</a> <p> <p> <a href="gnuplot_i_c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td colspan=2><br><h2>Functions</h2></td></tr> <tr><td nowrap align=right valign=top>char* </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a0">gnuplot_get_program_path</a> (char *pname)</td></tr> <tr><td> </td><td><font size=-1><em>Find out where a command lives in your PATH.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a>* </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a1">gnuplot_init</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>Opens up a gnuplot session, ready to receive commands.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a2">gnuplot_close</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *handle)</td></tr> <tr><td> </td><td><font size=-1><em>Closes a gnuplot session previously opened by <a class="el" href="gnuplot_i_c.html#a1">gnuplot_init</a>().</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a3">gnuplot_cmd</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *handle, char *cmd,...)</td></tr> <tr><td> </td><td><font size=-1><em>Sends a command to an active gnuplot session.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a4">gnuplot_setstyle</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *h, char *plot_style)</td></tr> <tr><td> </td><td><font size=-1><em>Change the plotting style of a gnuplot session.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a5">gnuplot_set_xlabel</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *h, char *label)</td></tr> <tr><td> </td><td><font size=-1><em>Sets the x label of a gnuplot session.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a6">gnuplot_set_ylabel</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *h, char *label)</td></tr> <tr><td> </td><td><font size=-1><em>Sets the y label of a gnuplot session.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a7">gnuplot_resetplot</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *h)</td></tr> <tr><td> </td><td><font size=-1><em>Resets a gnuplot session (next plot will erase previous ones).</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a8">gnuplot_plot_x</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *handle, double *d, int n, char *title)</td></tr> <tr><td> </td><td><font size=-1><em>Plots a 2d graph from a list of doubles.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a9">gnuplot_plot_xy</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *handle, double *x, double *y, int n, char *title)</td></tr> <tr><td> </td><td><font size=-1><em>Plot a 2d graph from a list of points.</em> <a href="#a9">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a10">gnuplot_plot_once</a> (char *title, char *style, char *label_x, char *label_y, double *x, double *y, int n)</td></tr> <tr><td> </td><td><font size=-1><em>Open a new session, plot a signal, close the session.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a11">gnuplot_plot_slope</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *handle, double a, double b, char *title)</td></tr> <tr><td> </td><td><font size=-1><em>Plot a slope on a gnuplot session.</em> <a href="#a11">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="gnuplot_i_c.html#a12">gnuplot_plot_equation</a> (<a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> *h, char *equation, char *title)</td></tr> <tr><td> </td><td><font size=-1><em>Plot a curve of given equation y=f(x).</em> <a href="#a12">More...</a><em></em></font><br><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> C interface to gnuplot. <p> <p> <dl compact><dt> <b>Author(s): </b><dd> N. Devillard </dl><dl compact><dt> <b>Date: </b><dd> Sep 1998 </dl><dl compact><dt> <b>Version: </b><dd> </dl><dl compact><dt> <b>Revision: </b><dd> 2.6 </dl> <p> gnuplot is a freely available, command-driven graphical display tool for Unix. It compiles and works quite well on a number of Unix flavours as well as other operating systems. The following module enables sending display requests to gnuplot through simple C calls. <p> <p> Definition in file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>.<hr><h2>Function Documentation</h2> <a name="a2" doxytag="gnuplot_i.c::gnuplot_close"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_close ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>handle</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Closes a gnuplot session previously opened by <a class="el" href="gnuplot_i_c.html#a1">gnuplot_init</a>(). <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>handle</em> </td><td> Gnuplot session control handle. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>Kills the child PID and deletes all opened temporary files. It is mandatory to call this function to close the handle, otherwise temporary files are not cleaned and child process might survive. <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00188">188</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a3" doxytag="gnuplot_i.c::gnuplot_cmd"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_cmd ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>handle</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>cmd</em>, </b></td> </tr> <tr> <td></td> <td><b> ... ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Sends a command to an active gnuplot session. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>handle</em> </td><td> Gnuplot session control handle </td></tr> <tr><td valign=top><em>cmd</em> </td><td> Command to send, same as a printf statement. <p> </td></tr> </table> </dl>This sends a string to an active gnuplot session, to be executed. There is strictly no way to know if the command has been successfully executed or not. The command syntax is the same as printf. <p> Examples: <p> <div class="fragment"><pre> <a class="code" href="gnuplot_i_c.html#a3">gnuplot_cmd</a>(g, <font class="stringliteral">"plot %d*x"</font>, 23.0); <a class="code" href="gnuplot_i_c.html#a3">gnuplot_cmd</a>(g, <font class="stringliteral">"plot %g * cos(%g * x)"</font>, 32.0, -3.0);</div></pre> <p> Since the communication to the gnuplot process is run through a standard Unix pipe, it is only unidirectional. This means that it is not possible for this interface to query an error status back from gnuplot. <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00231">231</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a0" doxytag="gnuplot_i.c::gnuplot_get_program_path"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> char * gnuplot_get_program_path ( </b></td> <td valign="bottom"><b> char * <em>pname</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Find out where a command lives in your PATH. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>pname</em> </td><td> Name of the program to look for. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> pointer to statically allocated character string. <p> </dl>This is the C equivalent to the 'which' command in Unix. It parses out your PATH environment variable to find out where a command lives. The returned character string is statically allocated within this function, i.e. there is no need to free it. Beware that the contents of this string will change from one call to the next, though (as all static variables in a function). <p> The input character string must be the name of a command without prefixing path of any kind, i.e. only the command name. The returned string is the path in which a command matching the same name was found. <p> Examples (assuming there is a prog named 'hello' in the cwd): <p> <div class="fragment"><pre> gnuplot_get_program_path("hello") returns "." gnuplot_get_program_path("ls") returns "/bin" gnuplot_get_program_path("csh") returns "/usr/bin" gnuplot_get_program_path("/bin/ls") returns NULL </div></pre> <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00084">84</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a1" doxytag="gnuplot_i.c::gnuplot_init"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * gnuplot_init ( </b></td> <td valign="bottom"><b> void ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Opens up a gnuplot session, ready to receive commands. <p> <dl compact><dt> <b>Returns: </b><dd> Newly allocated gnuplot control structure. <p> </dl>This opens up a new gnuplot session, ready for input. The struct controlling a gnuplot session should remain opaque and only be accessed through the provided functions. <p> The session must be closed using <a class="el" href="gnuplot_i_c.html#a2">gnuplot_close</a>(). <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00145">145</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. <p> Referenced by <a class="el" href="gnuplot_i_c-source.html#l00568">gnuplot_plot_once</a>(). </td> </tr> </table> <a name="a12" doxytag="gnuplot_i.c::gnuplot_plot_equation"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_plot_equation ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>h</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>equation</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>title</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Plot a curve of given equation y=f(x). <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>h</em> </td><td> Gnuplot session control handle. </td></tr> <tr><td valign=top><em>equation</em> </td><td> Equation to plot. </td></tr> <tr><td valign=top><em>title</em> </td><td> Title of the plot. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>Plots out a curve of given equation. The general form of the equation is y=f(x), you only provide the f(x) side of the equation. <p> Example: <p> <div class="fragment"><pre> <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> *h ; <font class="keywordtype">char</font> eq[80] ; h = <a class="code" href="gnuplot_i_c.html#a1">gnuplot_init</a>() ; strcpy(eq, <font class="stringliteral">"sin(x) * cos(2*x)"</font>) ; <a class="code" href="gnuplot_i_c.html#a12">gnuplot_plot_equation</a>(h, eq, <font class="stringliteral">"sine wave"</font>, normal) ; <a class="code" href="gnuplot_i_c.html#a2">gnuplot_close</a>(h) ;</div></pre> <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00694">694</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a10" doxytag="gnuplot_i.c::gnuplot_plot_once"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_plot_once ( </b></td> <td valign="bottom"><b> char * <em>title</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>style</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>label_x</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>label_y</em>, </b></td> </tr> <tr> <td></td> <td><b> double * <em>x</em>, </b></td> </tr> <tr> <td></td> <td><b> double * <em>y</em>, </b></td> </tr> <tr> <td></td> <td><b> int <em>n</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Open a new session, plot a signal, close the session. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>title</em> </td><td> Plot title </td></tr> <tr><td valign=top><em>style</em> </td><td> Plot style </td></tr> <tr><td valign=top><em>label_x</em> </td><td> Label for X </td></tr> <tr><td valign=top><em>label_y</em> </td><td> Label for Y </td></tr> <tr><td valign=top><em>x</em> </td><td> Array of X coordinates </td></tr> <tr><td valign=top><em>y</em> </td><td> Array of Y coordinates (can be NULL) </td></tr> <tr><td valign=top><em>n</em> </td><td> Number of values in x and y. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> <p> </dl>This function opens a new gnuplot session, plots the provided signal as an X or XY signal depending on a provided y, waits for a carriage return on stdin and closes the session. <p> It is Ok to provide an empty title, empty style, or empty labels for X and Y. Defaults are provided in this case. <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00568">568</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a11" doxytag="gnuplot_i.c::gnuplot_plot_slope"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_plot_slope ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>handle</em>, </b></td> </tr> <tr> <td></td> <td><b> double <em>a</em>, </b></td> </tr> <tr> <td></td> <td><b> double <em>b</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>title</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Plot a slope on a gnuplot session. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>handle</em> </td><td> Gnuplot session control handle. </td></tr> <tr><td valign=top><em>a</em> </td><td> Slope. </td></tr> <tr><td valign=top><em>b</em> </td><td> Intercept. </td></tr> <tr><td valign=top><em>title</em> </td><td> Title of the plot. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void @doc <p> </dl>Plot a slope on a gnuplot session. The provided slope has an equation of the form y=ax+b <p> Example: <p> <div class="fragment"><pre> <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> * h ; <font class="keywordtype">double</font> a, b ; h = <a class="code" href="gnuplot_i_c.html#a1">gnuplot_init</a>() ; <a class="code" href="gnuplot_i_c.html#a11">gnuplot_plot_slope</a>(h, 1.0, 0.0, <font class="stringliteral">"unity slope"</font>) ; sleep(2) ; <a class="code" href="gnuplot_i_c.html#a2">gnuplot_close</a>(h) ;</div></pre> <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00640">640</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a8" doxytag="gnuplot_i.c::gnuplot_plot_x"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_plot_x ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>handle</em>, </b></td> </tr> <tr> <td></td> <td><b> double * <em>d</em>, </b></td> </tr> <tr> <td></td> <td><b> int <em>n</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>title</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Plots a 2d graph from a list of doubles. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>handle</em> </td><td> Gnuplot session control handle. </td></tr> <tr><td valign=top><em>d</em> </td><td> Array of doubles. </td></tr> <tr><td valign=top><em>n</em> </td><td> Number of values in the passed array. </td></tr> <tr><td valign=top><em>title</em> </td><td> Title of the plot. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>Plots out a 2d graph from a list of doubles. The x-coordinate is the index of the double in the list, the y coordinate is the double in the list. <p> Example: <p> <div class="fragment"><pre> <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> *h ; <font class="keywordtype">double</font> d[50] ; <font class="keywordtype">int</font> i ; h = <a class="code" href="gnuplot_i_c.html#a1">gnuplot_init</a>() ; <font class="keywordflow">for</font> (i=0 ; i<50 ; i++) { d[i] = (<font class="keywordtype">double</font>)(i*i) ; } <a class="code" href="gnuplot_i_c.html#a8">gnuplot_plot_x</a>(h, d, 50, <font class="stringliteral">"parabola"</font>) ; sleep(2) ; <a class="code" href="gnuplot_i_c.html#a2">gnuplot_close</a>(h) ;</div></pre> <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00389">389</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a9" doxytag="gnuplot_i.c::gnuplot_plot_xy"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_plot_xy ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>handle</em>, </b></td> </tr> <tr> <td></td> <td><b> double * <em>x</em>, </b></td> </tr> <tr> <td></td> <td><b> double * <em>y</em>, </b></td> </tr> <tr> <td></td> <td><b> int <em>n</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>title</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Plot a 2d graph from a list of points. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>handle</em> </td><td> Gnuplot session control handle. </td></tr> <tr><td valign=top><em>x</em> </td><td> Pointer to a list of x coordinates. </td></tr> <tr><td valign=top><em>y</em> </td><td> Pointer to a list of y coordinates. </td></tr> <tr><td valign=top><em>n</em> </td><td> Number of doubles in x (assumed the same as in y). </td></tr> <tr><td valign=top><em>title</em> </td><td> Title of the plot. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>Plots out a 2d graph from a list of points. Provide points through a list of x and a list of y coordinates. Both provided arrays are assumed to contain the same number of values. <p> <div class="fragment"><pre> <a class="code" href="struct__GNUPLOT_CTRL_.html">gnuplot_ctrl</a> *h ; <font class="keywordtype">double</font> x[50] ; <font class="keywordtype">double</font> y[50] ; <font class="keywordtype">int</font> i ; h = <a class="code" href="gnuplot_i_c.html#a1">gnuplot_init</a>() ; <font class="keywordflow">for</font> (i=0 ; i<50 ; i++) { x[i] = (<font class="keywordtype">double</font>)(i)/10.0 ; y[i] = x[i] * x[i] ; } gnuplot_plot1_xy(h, x, y, 50, <font class="stringliteral">"parabola"</font>) ; sleep(2) ; <a class="code" href="gnuplot_i_c.html#a2">gnuplot_close</a>(h) ;</div></pre> <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00484">484</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a7" doxytag="gnuplot_i.c::gnuplot_resetplot"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_resetplot ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>h</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Resets a gnuplot session (next plot will erase previous ones). <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>h</em> </td><td> Gnuplot session control handle. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>Resets a gnuplot session, i.e. the next plot will erase all previous ones. <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00343">343</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a5" doxytag="gnuplot_i.c::gnuplot_set_xlabel"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_set_xlabel ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>h</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>label</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Sets the x label of a gnuplot session. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>h</em> </td><td> Gnuplot session control handle. </td></tr> <tr><td valign=top><em>label</em> </td><td> Character string to use for X label. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>Sets the x label for a gnuplot session. <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00301">301</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a6" doxytag="gnuplot_i.c::gnuplot_set_ylabel"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_set_ylabel ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>h</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>label</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Sets the y label of a gnuplot session. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>h</em> </td><td> Gnuplot session control handle. </td></tr> <tr><td valign=top><em>label</em> </td><td> Character string to use for Y label. </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>Sets the y label for a gnuplot session. <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00322">322</a> of file <a class="el" href="gnuplot_i_c-source.html">gnuplot_i.c</a>. </td> </tr> </table> <a name="a4" doxytag="gnuplot_i.c::gnuplot_setstyle"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td nowrap valign="top"><b> void gnuplot_setstyle ( </b></td> <td valign="bottom"><b> <a class="el" href="gnuplot_i_h.html#a0">gnuplot_ctrl</a> * <em>h</em>, </b></td> </tr> <tr> <td></td> <td><b> char * <em>plot_style</em> ) </b></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Change the plotting style of a gnuplot session. <p> <dl compact><dt> <b>Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>h</em> </td><td> Gnuplot session control handle </td></tr> <tr><td valign=top><em>plot_style</em> </td><td> Plotting-style to use (character string) </td></tr> </table> </dl><dl compact><dt> <b>Returns: </b><dd> void <p> </dl>The provided plotting style is a character string. It must be one of the following: <p> <ul> <li>lines<li>points<li>linespoints<li>impulses<li>dots<li>steps<li>errorbars<li>boxes<li>boxeserrorbars </ul> <p> Definition at line <a class="el" href="gnuplot_i_c-source.html#l00270">270</a> of file <a class="el" href="gnu... [truncated message content] |